TreeViewCellEditor.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:incubator-netbeans 作者:
/**
 * This is invoked if a TreeCellEditor is not supplied in the constructor.
 * It returns a TextField editor.
 */
@Override
protected TreeCellEditor createTreeCellEditor() {
    JTextField tf = new JTextField() {
            @Override
            public void addNotify() {
                stopped = cancelled = false;
                super.addNotify();
                requestFocus();
            }
        };
    //#137454 - text not visible in in-place editor
    String laf = UIManager.getLookAndFeel().getID();
    if( "GTK".equals( laf ) ) { //NOI18N
        tf.setBorder( BorderFactory.createEmptyBorder() );
    } else if( "Nimbus".equals( laf ) ) { //NOI18N
        tf.setBorder( BorderFactory.createLineBorder( new JTree().getBackground() ) );
    }
    tf.registerKeyboardAction( //TODO update to use inputMap/actionMap
        this, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, true), JComponent.WHEN_FOCUSED);

    tf.addFocusListener(this);

    Ed ed = new Ed(tf);
    ed.setClickCountToStart(1);
    ed.getComponent().getAccessibleContext().setAccessibleDescription(
        NbBundle.getMessage(TreeViewCellEditor.class, "ACSD_TreeViewCellEditor")
    ); // NOI18N
    ed.getComponent().getAccessibleContext().setAccessibleName(
        NbBundle.getMessage(TreeViewCellEditor.class, "ACSN_TreeViewCellEditor")
    ); // NOI18N

    return ed;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号