javax.swing.JButton.grabFocus()方法的使用及代码示例

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

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

JButton.grabFocus介绍

暂无

代码示例

代码示例来源:origin: de.dfki.mary/marytts-transcription

public void run() {
    startUpHelpDialog.toFront();
    closeHelp.grabFocus();
  }
});

代码示例来源:origin: de.dfki.mary/marytts-transcription

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

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

b.grabFocus();
pack();

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

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;
}

代码示例来源:origin: uk.ac.gate.plugins/tools

@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)

相关文章

JButton类方法