本文整理了Java中javax.swing.JTree.addKeyListener()
方法的一些代码示例,展示了JTree.addKeyListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.addKeyListener()
方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:addKeyListener
JTree.addKeyListener介绍
暂无
代码示例
代码示例来源:origin: skylot/jadx
tree.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
代码示例来源:origin: deathmarine/Luyten
tree.addMouseListener(tl);
tree.addTreeExpansionListener(new FurtherExpandingTreeExpansionListener());
tree.addKeyListener(new KeyAdapter() {
代码示例来源:origin: INRIA/spoon
/**
* This method initializes jTree
*
* @return javax.swing.JTree
*/
private JTree getJTree() {
if (jTree == null) {
jTree = new JTree(root);
jTree.addKeyListener(this);
jTree.addMouseListener(this);
}
return jTree;
}
代码示例来源:origin: jshiell/checkstyle-idea
final MouseListener treeMouseListener = new ToolWindowMouseListener();
resultsTree.addMouseListener(treeMouseListener);
resultsTree.addKeyListener(new ToolWindowKeyboardListener());
resultsTree.setCellRenderer(new ResultTreeRenderer());
代码示例来源:origin: ron190/jsql-injection
this.tree.addKeyListener(new KeyAdapter() {
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-navigation
public void addCloseAction(final Action action){
tree.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
if (e.getKeyCode()==KeyEvent.VK_ESCAPE) {
if (action != null) {
action.actionPerformed(null);
e.consume();
}
}
super.keyReleased(e);
}
});
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-navigation
public void addCloseAction(final Action action){
tree.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
if (e.getKeyCode()==KeyEvent.VK_ESCAPE) {
if (action != null) {
action.actionPerformed(null);
e.consume();
}
}
super.keyReleased(e);
}
});
}
}
代码示例来源:origin: pentaho/mondrian
tree.addKeyListener(
new KeyAdapter() {
public void keyPressed(KeyEvent e) {
代码示例来源:origin: net.openhft/spoon-core
/**
* This method initializes jTree
*
* @return javax.swing.JTree
*/
private JTree getJTree() {
if (jTree == null) {
jTree = new JTree(root);
jTree.addKeyListener(this);
jTree.addMouseListener(this);
}
return jTree;
}
代码示例来源:origin: omegat-org/omegat
static void install(JTree tree) {
TreeListener listener = new TreeListener(tree);
tree.addMouseListener(listener);
tree.addKeyListener(listener);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf
void connect( JTree errorTree, JComboBox severityComboBox,
JCheckBox tasklistCheckBox, JPanel customizerPanel,
JEditorPane descriptionTextArea) {
this.errorTree = errorTree;
this.severityComboBox = severityComboBox;
this.tasklistCheckBox = tasklistCheckBox;
this.customizerPanel = customizerPanel;
this.descriptiOnTextArea= descriptionTextArea;
valueChanged( null );
errorTree.addKeyListener(this);
errorTree.addMouseListener(this);
errorTree.getSelectionModel().addTreeSelectionListener(this);
severityComboBox.addActionListener(this);
tasklistCheckBox.addChangeListener(this);
}
代码示例来源:origin: org.languagetool/languagetool-gui-commons
static void install(JTree tree) {
TreeListener listener = new TreeListener(tree);
tree.addMouseListener(listener);
tree.addKeyListener(listener);
tree.addTreeWillExpandListener(listener);
}
代码示例来源:origin: infinitest/infinitest
private static JTree createTree() {
JTree resultsTree = new JTree();
resultsTree.setName("TREEVIEW");
resultsTree.setRootVisible(false);
resultsTree.setEditable(false);
resultsTree.setShowsRootHandles(true);
resultsTree.setCellRenderer(new FailureCellRenderer());
ToolTipManager tipManager = ToolTipManager.sharedInstance();
tipManager.registerComponent(resultsTree);
resultsTree.addKeyListener(new EnterPressListener());
return resultsTree;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project
public CheckTreeView(TransferSelectorModel model) {
CheckListener listener = new CheckListener(model);
tree.addMouseListener(listener);
tree.addKeyListener(listener);
CheckRenderer renderer = new CheckRenderer(model);
tree.setCellRenderer(renderer);
tree.setEditable(false);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-java-hints-analyzer
/** Creates a new instance of CheckTreeView */
public CheckTreeView() {
setFocusable( false );
CheckListener l = new CheckListener();
tree.addMouseListener( l );
tree.addKeyListener( l );
CheckRenderer check = new CheckRenderer();
tree.setCellRenderer( check );
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.setShowsRootHandles(false);
InputMap input = tree.getInputMap( JTree.WHEN_FOCUSED );
if( null != input )
input.remove( KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0) );
setBorder( UIManager.getBorder("ScrollPane.border") );
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-modelutil
/** Creates a new instance of CheckTreeView */
public CheckTreeView() {
setFocusable(false);
CheckListener l = new CheckListener();
tree.addMouseListener(l);
tree.addKeyListener(l);
CheckRenderer check = new CheckRenderer();
tree.setCellRenderer(check);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.setShowsRootHandles(false);
InputMap input = tree.getInputMap(JTree.WHEN_FOCUSED);
if (null != input) {
input.remove(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
}
setBorder(UIManager.getBorder("ScrollPane.border")); // NOI18N
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
private void initTree() {
JTree tree = new JTree(getRootNode());
tree.setCellRenderer(new CheckBoxTreeRenderer());
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.putClientProperty("JTree.lineStyle", "Angled"); //NOI18N
NodeSelectionListener listener = new NodeSelectionListener(tree);
tree.addMouseListener(listener);
tree.addKeyListener(listener);
tree.expandRow(0);
tree.setShowsRootHandles(true);
tree.setSelectionRow(0);
initTree(tree);
scrollPane.add(tree);
scrollPane.setViewportView(tree);
}
代码示例来源:origin: UNIVALI-LITE/Portugol-Studio
private void configurarArvore()
{
arvore.setModel(criarModeloInicialArvore());
arvore.setCellRenderer(new Renderizador());
arvore.setRootVisible(false);
arvore.setShowsRootHandles(true);
arvore.addKeyListener(new ArvoreTopicosKeyListener(arvore));
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
private void configUi()
{
_tree = new JTree();
_tree.setModel( new DefaultTreeModel( new MessageTree( _tree ) ) );
_tree.setBackground( Scheme.active().getWindow() );
_tree.setRootVisible( false );
_tree.setShowsRootHandles( true );
_tree.setRowHeight( 22 );
_tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION );
_tree.setVisibleRowCount( 20 );
_tree.setCellRenderer( new LabTreeCellRenderer( _tree ) );
_tree.addMouseListener( new MouseHandler() );
_tree.addKeyListener( new TreeKeyHandler() );
_scroller = new JScrollPane( _tree );
_scroller.setBorder( new MatteBorder( 0, 1, 1, 1, Scheme.active().getScrollbarBorderColor() ) );
add( _scroller, BorderLayout.CENTER );
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
/**
* Creates the JList used in the popup to display the items in the combo box
* model. This method is called when the UI class is created.
*
* @return a JList
used to display the combo box items
*/
protected JTree createTree() {
JTree tree = new JTree(model);
tree.setName("TreePopup.tree");
tree.setFont(getFont());
tree.setForeground(getForeground());
tree.setBackground(getBackground());
tree.setBorder(null);
tree.setFocusable(true);
tree.addMouseListener(handler);
tree.addKeyListener(handler);
tree.setCellRenderer(new Renderer());
return tree;
}