javax.swing.JMenu.requestFocus()方法的使用及代码示例

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

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

JMenu.requestFocus介绍

暂无

代码示例

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

@Override
public void actionPerformed(ActionEvent e) {
  JMenuItem item = (JMenuItem) e.getSource();
  MenuBarCoder.this.menu.setText(item.getText());
  MenuBarCoder.this.menu.requestFocus();
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = FOCUS_JSDOC)
@Override
public void focus() {
  super.requestFocus();
}

代码示例来源:origin: robward-scisys/sldeditor

/**
 * Sets the selected data.
 *
 * @param selectedData the new selected data
 */
public void setSelectedData(ValueComboBoxData selectedData) {
  this.selectedData = selectedData;
  if (selectedData != null) {
    this.menu.setText(selectedData.getText());
    this.menu.requestFocus();
  }
  if (listener != null) {
    listener.optionSelected(selectedData);
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Invoked when the mouse has been clicked on the menu. This method clears or sets the selection path of the
 * MenuSelectionManager.
 *
 * @param e the mouse event
 */
public void mousePressed(MouseEvent e) {
  JMenu menu = (JMenu) menuItem;
  if (!menu.isEnabled())
    return;
  setMouseOver(true);
  if (!SwingUtilities.isLeftMouseButton(e)) {
    return;
  }
  if (isClickOnButton(e, menu)) {
    if (((JideSplitButton) menuItem).isButtonEnabled()) {
      // click button
      menu.getModel().setArmed(true);
      menu.getModel().setPressed(true);
    }
    if (!menu.hasFocus() && menu.isRequestFocusEnabled()) {
      menu.requestFocus();
    }
  }
  else {
    downButtonPressed(menu);
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Invoked when the mouse has been clicked on the menu. This method clears or sets the selection path of the
 * MenuSelectionManager.
 *
 * @param e the mouse event
 */
public void mousePressed(MouseEvent e) {
  JMenu menu = (JMenu) menuItem;
  if (!menu.isEnabled())
    return;
  setMouseOver(true);
  if (!SwingUtilities.isLeftMouseButton(e)) {
    return;
  }
  if (isClickOnButton(e, menu)) {
    if (((JideSplitButton) menuItem).isButtonEnabled()) {
      // click button
      menu.getModel().setArmed(true);
      menu.getModel().setPressed(true);
    }
    if (!menu.hasFocus() && menu.isRequestFocusEnabled()) {
      menu.requestFocus();
    }
  }
  else {
    downButtonPressed(menu);
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Invoked when the mouse has been clicked on the menu. This method clears or sets the selection path of the
 * MenuSelectionManager.
 *
 * @param e the mouse event
 */
public void mousePressed(MouseEvent e) {
  JMenu menu = (JMenu) menuItem;
  if (!menu.isEnabled())
    return;
  setMouseOver(true);
  if (!SwingUtilities.isLeftMouseButton(e)) {
    return;
  }
  if (isClickOnButton(e, menu)) {
    if (((JideSplitButton) menuItem).isButtonEnabled()) {
      // click button
      menu.getModel().setArmed(true);
      menu.getModel().setPressed(true);
    }
    if (!menu.hasFocus() && menu.isRequestFocusEnabled()) {
      menu.requestFocus();
    }
  }
  else {
    downButtonPressed(menu);
  }
}

相关文章