javax.swing.AbstractButton.setRequestFocusEnabled()方法的使用及代码示例

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

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

AbstractButton.setRequestFocusEnabled介绍

暂无

代码示例

代码示例来源:origin: org.fudaa.framework.ebli/ebli-2d

private void decoreButton(final AbstractButton _bt) {
 _bt.setRequestFocusEnabled(false);
 _bt.setMargin(INSETS1111);
 _bt.addActionListener(this);
}

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

/**
 * Creates the close button. Subclass can override it to create your own close button.
 *
 * @param closeAction the close action
 *
 * @return the close button.
 */
protected AbstractButton createCloseButton(AbstractAction closeAction) {
  AbstractButton button = new JButton(getImageIcon(SearchableBarIconsFactory.Buttons.CLOSE));
  button.addActionListener(closeAction);
  button.setRolloverEnabled(true);
  button.setBorder(BorderFactory.createEmptyBorder());
  button.setOpaque(false);
  button.setRequestFocusEnabled(false);
  button.setFocusable(false);
  button.setRolloverIcon(getImageIcon(SearchableBarIconsFactory.Buttons.CLOSE_ROLLOVER));
  return button;
}

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

/**
 * Creates the repeat button. By default it will return a JCheckBox. Subclass class can override it to return your
 * own button or customize the button created by default as long as it can set underlying Searchable's repeats
 * property.
 *
 * @return the repeat button.
 */
protected AbstractButton createRepeatsButton() {
  AbstractButton button = new JCheckBox(getResourceString("SearchableBar.repeats"));
  button.setMnemonic(getResourceString("SearchableBar.repeats.mnemonic").charAt(0));
  button.setRequestFocusEnabled(false);
  button.setFocusable(false);
  button.setSelected(getSearchable().isRepeats());
  button.addItemListener(new ItemListener() {
    public void itemStateChanged(ItemEvent e) {
      if (e.getSource() instanceof AbstractButton) {
        getSearchable().setRepeats(((AbstractButton) e.getSource()).isSelected());
      }
    }
  });
  button.setOpaque(false);
  return button;
}

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

/**
 * Creates the button that is used in the Calculator. By default, it will create a JideButton. Here is the code. You
 * can override it to create your own button.
 * <pre><code>
 * AbstractButton button = new JideButton(text, icon);
 * button.setOpaque(true);
 * button.setContentAreaFilled(true);
 * button.setRequestFocusEnabled(false);
 * button.setFocusable(false);
 * button.addActionListener(this);
 * return button;
 * </code></pre>
 *
 * @param text the text on the button.
 * @param icon the icon on the button.
 * @return the button.
 */
protected AbstractButton createButton(String text, Icon icon) {
  AbstractButton button = new JideButton(text, icon);
  button.setOpaque(true);
  button.setContentAreaFilled(true);
  button.setRequestFocusEnabled(false);
  button.setFocusable(false);
  button.addActionListener(this);
  return button;
}

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

/**
 * Creates the find next button. Subclass can override it to create your own find next button.
 *
 * @param findNextAction the find next action
 *
 * @return the find next button.
 */
protected AbstractButton createFindNextButton(AbstractAction findNextAction) {
  AbstractButton button = new JButton(_compact ? "" : getResourceString("SearchableBar.findNext"),
      getImageIcon(SearchableBarIconsFactory.Buttons.NEXT));
  button.setToolTipText(getResourceString("SearchableBar.findNext.tooltip"));
  button.setMnemonic(getResourceString("SearchableBar.findNext.mnemonic").charAt(0));
  button.setRolloverIcon(getImageIcon(SearchableBarIconsFactory.Buttons.NEXT_ROLLOVER));
  button.setDisabledIcon(getImageIcon(SearchableBarIconsFactory.Buttons.NEXT_DISABLED));
  button.setRequestFocusEnabled(false);
  button.setFocusable(false);
  button.addActionListener(findNextAction);
  button.setEnabled(false);
  return button;
}

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

/**
 * Creates the find prev button. Subclass can override it to create your own find prev button.
 *
 * @param findPrevAction the find previous action
 *
 * @return the find prev button.
 */
protected AbstractButton createFindPrevButton(AbstractAction findPrevAction) {
  AbstractButton button = new JButton(_compact ? "" : getResourceString("SearchableBar.findPrevious"),
      getImageIcon(SearchableBarIconsFactory.Buttons.PREVIOUS));
  button.setToolTipText(getResourceString("SearchableBar.findPrevious.tooltip"));
  button.setMnemonic(getResourceString("SearchableBar.findPrevious.mnemonic").charAt(0));
  button.setRolloverIcon(getImageIcon(SearchableBarIconsFactory.Buttons.PREVIOUS_ROLLOVER));
  button.setDisabledIcon(getImageIcon(SearchableBarIconsFactory.Buttons.PREVIOUS_DISABLED));
  button.setRequestFocusEnabled(false);
  button.setFocusable(false);
  button.addActionListener(findPrevAction);
  button.setEnabled(false);
  return button;
}

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

/**
 * Creates the highlight button.
 *
 * @return the highlight button.
 */
protected AbstractButton createHighlightButton() {
  AbstractButton button = new JToggleButton(_compact ? "" : getResourceString("SearchableBar.highlights"),
      getImageIcon(SearchableBarIconsFactory.Buttons.HIGHLIGHTS));
  button.setToolTipText(getResourceString("SearchableBar.highlights.tooltip"));
  button.setMnemonic(getResourceString("SearchableBar.highlights.mnemonic").charAt(0));
  button.setSelectedIcon(getImageIcon(SearchableBarIconsFactory.Buttons.HIGHLIGHTS_SELECTED));
  button.setDisabledIcon(getImageIcon(SearchableBarIconsFactory.Buttons.HIGHLIGHTS_DISABLED));
  button.setRolloverIcon(getImageIcon(SearchableBarIconsFactory.Buttons.HIGHLIGHTS_ROLLOVER));
  button.setRolloverSelectedIcon(getImageIcon(SearchableBarIconsFactory.Buttons.HIGHLIGHTS_ROLLOVER_SELECTED));
  button.setRequestFocusEnabled(false);
  button.setFocusable(false);
  AbstractAction highlightAllAction = new AbstractAction() {
    private static final long serialVersionUID = 5170786863522331175L;
    public void actionPerformed(ActionEvent e) {
      addSearchingTextToHistory(getSearchingText());
      highlightAllOrNext();
    }
  };
  button.addActionListener(highlightAllAction);
  button.setEnabled(false);
  return button;
}

相关文章

微信公众号

最新文章

更多

AbstractButton类方法