@Override public void keyPressed(KeyEvent evt) { switch (evt.getKeyCode()) { case KeyEvent.VK_SPACE: goToSelectedNode(M_OPEN); // f**k me dead EventQueue.invokeLater( new Runnable() { @Override public void run() { resultTree.requestFocus(); } }); evt.consume(); break; case KeyEvent.VK_ENTER: goToSelectedNode(M_OPEN); evt.consume(); break; case KeyEvent.VK_DELETE: removeSelectedNode(); evt.consume(); break; default: break; } }
/* (non-Javadoc) * @see java.awt.Component#doLayout() */ public void doLayout() { if (EventQueue.isDispatchThread()) { Dimension size = this.getSize(); this.rblock.setBounds(0, 0, size.width, size.height); this.removeAll(); this.rblock.layout(size.width, size.height); this.rblock.updateWidgetBounds(); } else { EventQueue.invokeLater( new Runnable() { public void run() { HtmlBlock.this.doLayout(); } }); } }
public static void main(String... args) { EventQueue.invokeLater( new Runnable() { @Override public void run() { createAndShowGUI(); } }); }
/** * @param searchNode the result node * @param selectNode the node that must be selected, or null * @since jEdit 4.3pre12 */ public void searchDone( final DefaultMutableTreeNode searchNode, final DefaultMutableTreeNode selectNode) { stop.setEnabled(false); final int nodeCount = searchNode.getChildCount(); if (nodeCount < 1) { searchFailed(); return; } caption.setText( jEdit.getProperty("hypersearch-results.done", new String[] {trimSearchString()})); EventQueue.invokeLater( new Runnable() { @Override public void run() { if (!multiStatus) { for (int i = 0; i < resultTreeRoot.getChildCount(); i++) { resultTreeRoot.remove(0); } } resultTreeRoot.add(searchNode); resultTreeModel.reload(resultTreeRoot); for (int i = 0; i < nodeCount; i++) { TreePath lastNode = new TreePath(((DefaultMutableTreeNode) searchNode.getChildAt(i)).getPath()); resultTree.expandPath(lastNode); } TreePath treePath; if (selectNode == null) { treePath = new TreePath(new Object[] {resultTreeRoot, searchNode}); } else { treePath = new TreePath(selectNode.getPath()); } resultTree.setSelectionPath(treePath); resultTree.scrollPathToVisible(treePath); } }); } // }}}