javax.swing.JTree.addFocusListener()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(213)

本文整理了Java中javax.swing.JTree.addFocusListener()方法的一些代码示例,展示了JTree.addFocusListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.addFocusListener()方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:addFocusListener

JTree.addFocusListener介绍

暂无

代码示例

代码示例来源:origin: ron190/jsql-injection

this.tree.addFocusListener(new FocusListener() {

代码示例来源:origin: stackoverflow.com

final JTree tree = new JTree();
 tree.setEditable(true);
 // this will often help (see its api doc), but no guarantee
 tree.setInvokesStopCellEditing(true);
 // a focusListener is **not** helping
 FocusListener l = new FocusListener() {
   @Override
   public void focusGained(FocusEvent e) {
   }
   @Override
   public void focusLost(FocusEvent e) {
     // this would prevent editing at all
     // tree.stopEditing();
   }
 };
 tree.addFocusListener(l);
 JComponent panel = new JPanel(new BorderLayout());
 panel.add(new JScrollPane(tree));
 panel.add(new JButton("just something to focus"), BorderLayout.SOUTH);

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-languages

private TokensBrowserTopComponent () {
    initComponents ();
    setLayout (new BorderLayout ());
    tree = new JTree ();
    tree.setCellRenderer (new Renderer ());
    tree.addTreeSelectionListener (new TreeSelectionListener () {
      public void valueChanged (TreeSelectionEvent e) {
        if (!listen) return;
        mark ();
      }
    });
    tree.addFocusListener (new FocusListener () {
      public void focusGained (FocusEvent e) {
        mark ();
      }
      public void focusLost (FocusEvent e) {
        mark ();
      }
    });
    tree.setRootVisible (false);
    add (new JScrollPane (tree), BorderLayout.CENTER);
    setName (NbBundle.getMessage (TokensBrowserTopComponent.class, "CTL_TokensBrowserTopComponent"));
    setToolTipText (NbBundle.getMessage (TokensBrowserTopComponent.class, "HINT_TokensBrowserTopComponent"));
//        setIcon(Utilities.loadImage(ICON_PATH, true));
  }

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-languages

private ASTBrowserTopComponent () {
    initComponents ();
    setLayout (new BorderLayout ());
    tree = new JTree ();
    tree.addTreeSelectionListener (new TreeSelectionListener () {
      public void valueChanged (TreeSelectionEvent e) {
        mark ();
      }
    });
    tree.addFocusListener (new FocusListener () {
      public void focusGained (FocusEvent e) {
        mark ();
      }
      public void focusLost (FocusEvent e) {
        mark ();
      }
    });
    tree.setShowsRootHandles (true);
    tree.setModel (new DefaultTreeModel (new TNode (null, null)));
    tree.setCellRenderer (new Renderer ());
    add (new JScrollPane (tree), BorderLayout.CENTER);
    setName (NbBundle.getMessage (ASTBrowserTopComponent.class, "CTL_ASTBrowserTopComponent"));
    setToolTipText (NbBundle.getMessage (ASTBrowserTopComponent.class, "HINT_ASTBrowserTopComponent"));
//        setIcon(Utilities.loadImage(ICON_PATH, true));
  }

代码示例来源:origin: org.apache.uima/uimaj-tools

this.styleMap.put(CAS.TYPE_NAME_ANNOTATION, defaultStyle);
this.textPopup = new JPopupMenu();
this.fsTree.addFocusListener(new TreeFocusHandler(this.fsTree));
this.indexTree.addFocusListener(new TreeFocusHandler(this.indexTree));
initKeyMap();

代码示例来源:origin: mucommander/mucommander

tree.addFocusListener(this);

代码示例来源:origin: org.netbeans.api/org-openide-explorer

@Override
protected void setTree(JTree newTree) {
  if ((newTree != tree) && (timer != null) && timer.isRunning()) {
    tree.removeMouseMotionListener(this);
  }
  if (newTree != tree) {
    if (tree != null) {
      tree.removeMouseListener(this);
      tree.removeFocusListener(this);
    }
    if (newTree != null) {
      newTree.addMouseListener(this);
      newTree.addFocusListener(this);
    }
  }
  super.setTree(newTree);
}

代码示例来源:origin: org.gephi/directory-chooser

TreeKeyHandler keyHandler = new TreeKeyHandler();
tree.addKeyListener(keyHandler);
tree.addFocusListener(keyHandler);
tree.addMouseListener(dirHandler);
tree.addFocusListener(dirHandler);
tree.addTreeSelectionListener(dirHandler);

代码示例来源:origin: org.netbeans.api/org-openide-explorer

KeyStroke.getKeyStroke( KeyEvent.VK_F10, KeyEvent.SHIFT_DOWN_MASK ), "org.openide.actions.PopupAction" );
getActionMap().put("org.openide.actions.PopupAction", defaultActionListener.popup);
tree.addFocusListener(defaultActionListener);
tree.addMouseListener(defaultActionListener);

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

tree.addFocusListener(defaultActionListener);
tree.addMouseListener(defaultActionListener);

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

tree.addFocusListener(defaultActionListener);
tree.addMouseListener(defaultActionListener);

相关文章

JTree类方法