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

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

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

JButton.addFocusListener介绍

暂无

代码示例

代码示例来源:origin: marytts/marytts

bDetails.addFocusListener(new java.awt.event.FocusAdapter() {
  public void focusGained(java.awt.event.FocusEvent evt) {
    formFocusGained(evt);

代码示例来源:origin: marytts/marytts

bDetails.addFocusListener(new java.awt.event.FocusAdapter() {
  public void focusGained(java.awt.event.FocusEvent evt) {
    formFocusGained(evt);

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

btnBrowse.addFocusListener(listener);
cboxLocation.addItemListener(listener);
tfClassToTest.getDocument().addDocumentListener(listener);

代码示例来源:origin: apache/batik

/**
 * Gets the Add button.
 */
private JButton getAddButton() {
  if (addButton == null) {
    addButton = getButtonFactory().createJButton("AddButton");
    addButton.addFocusListener(new NodePickerEditListener());
  }
  return addButton;
}

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

getContentPane().setLayout(new BorderLayout());
JButton b = new JButton();
b.addFocusListener(new FocusListener() {

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Gets the Remove button.
 */
private JButton getRemoveButton() {
  if (removeButton == null) {
    removeButton = getButtonFactory().createJButton("RemoveButton");
    removeButton.addFocusListener(new NodePickerEditListener());
  }
  return removeButton;
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Gets the Add button.
 */
private JButton getAddButton() {
  if (addButton == null) {
    addButton = getButtonFactory().createJButton("AddButton");
    addButton.addFocusListener(new NodePickerEditListener());
  }
  return addButton;
}

代码示例来源:origin: apache/batik

/**
 * Gets the Remove button.
 */
private JButton getRemoveButton() {
  if (removeButton == null) {
    removeButton = getButtonFactory().createJButton("RemoveButton");
    removeButton.addFocusListener(new NodePickerEditListener());
  }
  return removeButton;
}

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

private void setButtonDefaults(JButton but) {
  but.setBorderPainted(false);
  but.setBackground(Color.DARK_GRAY);
  but.setForeground(Color.WHITE);
  but.setName(but.getText().toLowerCase());
  but.setPreferredSize(buttonSize);
  but.addActionListener(this);
  //add focus listener
  final Color clr = ContentPane.getBackground();
  final int r = clr.getRed();
  final int g = clr.getGreen();
  final int b = clr.getBlue();
  but.addFocusListener(new FocusListener() {
    @Override
    public void focusLost(FocusEvent e) {
      log("r = " + r + ", g = " + g + ", b = " + b);
      JButton button = (JButton) e.getSource();
      button.setBackground(new Color(r, g, b));
    }

    @Override
    public void focusGained(FocusEvent e) {
      JButton button = (JButton) e.getSource();
      button.setBackground(new Color(r, g, b));
    }
  });
}

代码示例来源:origin: org.rescarta.rc-cmgr/rc-cmgr

this.addAbstractJButton.setToolTipText("Add Abstract");
this.addAbstractJButton.addActionListener(this);
this.addAbstractJButton.addFocusListener(this);
this.modifyAbstractJButton.setToolTipText("Modify Abstract");
this.modifyAbstractJButton.addActionListener(this);
this.modifyAbstractJButton.addFocusListener(this);
this.removeAbstractJButton.setToolTipText("Remove Abstract");
this.removeAbstractJButton.addActionListener(this);
this.removeAbstractJButton.addFocusListener(this);
this.addIpFilterJButton.setToolTipText("Add IP Filter");
this.addIpFilterJButton.addActionListener(this);
this.addIpFilterJButton.addFocusListener(this);
this.modifyIpFilterJButton.setToolTipText("Modify IP Filter");
this.modifyIpFilterJButton.addActionListener(this);
this.modifyIpFilterJButton.addFocusListener(this);
this.removeIpFilterJButton.setToolTipText("Remove IP Filter");
this.removeIpFilterJButton.addActionListener(this);
this.removeIpFilterJButton.addFocusListener(this);
this.addPermissionJButton.setToolTipText("Add Permission");
this.addPermissionJButton.addActionListener(this);
this.addPermissionJButton.addFocusListener(this);
this.modifyPermissionJButton.setToolTipText("Modify Permission");

代码示例来源:origin: freeplane/freeplane

days[index].addActionListener(this);
days[index].addKeyListener(this);
days[index].addFocusListener(this);

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

b1 = new JButton("Start");// The JButton name.
b1.setRequestFocusEnabled(false);
b1.addFocusListener(this);
b1.setLocation(10, 12);
panel.add(b1);
b2.addFocusListener(this);
b2.setLocation(70, 12);
panel.add(b2);

代码示例来源:origin: gurkenlabs/litiengine

this.btnDelete.addFocusListener(new FocusListener() {
 @Override
 public void focusLost(FocusEvent e) {

代码示例来源:origin: mucommander/mucommander

button.addFocusListener(this);

代码示例来源:origin: GoldenGnu/jeveassets

jColor.addFocusListener(listener);
jColor.setActionCommand(TagsDialogAction.SHOW_COLOR.name());
jColor.addActionListener(listener);
jOK.setActionCommand(TagsDialogAction.OK.name());
jOK.addActionListener(listener);
jOK.addFocusListener(listener);
jCancel.addFocusListener(listener);

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

bDetails.addFocusListener(new java.awt.event.FocusAdapter() {
  public void focusGained(java.awt.event.FocusEvent evt) {
    formFocusGained(evt);

代码示例来源:origin: org.apache.uima/uimaj-tools

viewButton.setRequestFocusEnabled(true);
viewButton.requestFocus();
viewButton.addFocusListener(tlf);

代码示例来源:origin: net.sf.cuf/cuf-swing

getRootPane().setDefaultButton(mButtonOK);
mButtonCancel.addFocusListener(new FocusAdapter()

代码示例来源:origin: org.jclarion/clarion-runtime

} } );
button.addFocusListener(new FocusListener() {
  @Override
  public void focusGained(FocusEvent e) {

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

wwwLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
wwwLabel.setNextFocusableComponent(wikiLabel);
wwwLabel.addFocusListener(new java.awt.event.FocusAdapter() {
  public void focusGained(java.awt.event.FocusEvent evt) {
    wwwLabelFocusGained(evt);
wikiLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
wikiLabel.setNextFocusableComponent(downloadsLabel);
wikiLabel.addFocusListener(new java.awt.event.FocusAdapter() {
  public void focusGained(java.awt.event.FocusEvent evt) {
    wikiLabelFocusGained(evt);
downloadsLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
downloadsLabel.setNextFocusableComponent(dynamicContentPane);
downloadsLabel.addFocusListener(new java.awt.event.FocusAdapter() {
  public void focusGained(java.awt.event.FocusEvent evt) {
    downloadsLabelFocusGained(evt);
backToTopLabel.addFocusListener(new java.awt.event.FocusAdapter() {
  public void focusGained(java.awt.event.FocusEvent evt) {
    backToTopLabelFocusGained(evt);

相关文章

微信公众号

最新文章

更多

JButton类方法