public void run() { startUpHelpDialog.toFront(); closeHelp.grabFocus(); } });
private void helpMenuItemActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_helpMenuItemActionPerformed try { htmlEditor.setContentType("text/html; charset=UTF-8"); htmlEditor .read(new InputStreamReader(TranscriptionGUI.class.getResourceAsStream("instructions.html"), "UTF-8"), null); htmlEditor.setPreferredSize(new Dimension(500, 400)); htmlEditor.setEditable(true); htmlEditor.updateUI(); startUpHelpDialog.setSize(new Dimension(700, 500)); startUpHelpDialog.repaint(); closeHelp.grabFocus(); startUpHelpDialog.setVisible(true); startUpHelpDialog.repaint(); } catch (IOException e) { e.printStackTrace(); System.out.println("Could not read file : " + e.getMessage()); } }// GEN-LAST:event_helpMenuItemActionPerformed
b.grabFocus(); pack();
private static ClientUtils.SourceCodeSelection[] performDisplay(final RootMethodsPanel rm) { final DialogDescriptor dd = new DialogDescriptor(rm, Bundle.RootMethodsPanel_SpecifyRootMethodsDialogCaption()); final Dialog d = DialogDisplayer.getDefault().createDialog(dd); if (rm.addFromJarButton.isEnabled()) { rm.addFromJarButton.grabFocus(); } d.setVisible(true); if (dd.getValue() == DialogDescriptor.OK_OPTION) { ClientUtils.SourceCodeSelection[] ret = new ClientUtils.SourceCodeSelection[rm.selectedRoots.size()]; rm.selectedRoots.toArray(ret); return ret; } return null; }
@Override public void mouseClicked(MouseEvent e) { if (! (e.getSource() instanceof JButton)) return; JButton source = (JButton) e.getSource(); //check if CTRL or Shift is pressed and if not, clear the selection if ((! (e.isControlDown() || e.isShiftDown())) && SwingUtilities.isLeftMouseButton(e)) clearSelection(); //and select the current node if (SwingUtilities.isLeftMouseButton(e)) //if (e.getModifiers() == e.BUTTON1_MASK) selectNode(e); //only repspond to right-clicks here by displaying the popup if (SwingUtilities.isRightMouseButton(e)) { //if button not in focus, grad the focus and select it! if ( source.getBackground() != selectedNodeColor ) { source.grabFocus(); source.doClick(); selectNode(e); } //Out.println(e.getComponent().getClass() + " right-clicked!"); showRightClickPopup(e); } //end of right-click processing }// public void mouseClicked(MouseEvent e)