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

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

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

JButton.addFocusListener介绍

暂无

代码示例

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

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

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

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

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

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

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

  1. /**
  2. * Gets the Add button.
  3. */
  4. private JButton getAddButton() {
  5. if (addButton == null) {
  6. addButton = getButtonFactory().createJButton("AddButton");
  7. addButton.addFocusListener(new NodePickerEditListener());
  8. }
  9. return addButton;
  10. }

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

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

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

  1. /**
  2. * Gets the Remove button.
  3. */
  4. private JButton getRemoveButton() {
  5. if (removeButton == null) {
  6. removeButton = getButtonFactory().createJButton("RemoveButton");
  7. removeButton.addFocusListener(new NodePickerEditListener());
  8. }
  9. return removeButton;
  10. }

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

  1. /**
  2. * Gets the Add button.
  3. */
  4. private JButton getAddButton() {
  5. if (addButton == null) {
  6. addButton = getButtonFactory().createJButton("AddButton");
  7. addButton.addFocusListener(new NodePickerEditListener());
  8. }
  9. return addButton;
  10. }

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

  1. /**
  2. * Gets the Remove button.
  3. */
  4. private JButton getRemoveButton() {
  5. if (removeButton == null) {
  6. removeButton = getButtonFactory().createJButton("RemoveButton");
  7. removeButton.addFocusListener(new NodePickerEditListener());
  8. }
  9. return removeButton;
  10. }

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

  1. private void setButtonDefaults(JButton but) {
  2. but.setBorderPainted(false);
  3. but.setBackground(Color.DARK_GRAY);
  4. but.setForeground(Color.WHITE);
  5. but.setName(but.getText().toLowerCase());
  6. but.setPreferredSize(buttonSize);
  7. but.addActionListener(this);
  8. //add focus listener
  9. final Color clr = ContentPane.getBackground();
  10. final int r = clr.getRed();
  11. final int g = clr.getGreen();
  12. final int b = clr.getBlue();
  13. but.addFocusListener(new FocusListener() {
  14. @Override
  15. public void focusLost(FocusEvent e) {
  16. log("r = " + r + ", g = " + g + ", b = " + b);
  17. JButton button = (JButton) e.getSource();
  18. button.setBackground(new Color(r, g, b));
  19. }
  20. @Override
  21. public void focusGained(FocusEvent e) {
  22. JButton button = (JButton) e.getSource();
  23. button.setBackground(new Color(r, g, b));
  24. }
  25. });
  26. }

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

  1. this.addAbstractJButton.setToolTipText("Add Abstract");
  2. this.addAbstractJButton.addActionListener(this);
  3. this.addAbstractJButton.addFocusListener(this);
  4. this.modifyAbstractJButton.setToolTipText("Modify Abstract");
  5. this.modifyAbstractJButton.addActionListener(this);
  6. this.modifyAbstractJButton.addFocusListener(this);
  7. this.removeAbstractJButton.setToolTipText("Remove Abstract");
  8. this.removeAbstractJButton.addActionListener(this);
  9. this.removeAbstractJButton.addFocusListener(this);
  10. this.addIpFilterJButton.setToolTipText("Add IP Filter");
  11. this.addIpFilterJButton.addActionListener(this);
  12. this.addIpFilterJButton.addFocusListener(this);
  13. this.modifyIpFilterJButton.setToolTipText("Modify IP Filter");
  14. this.modifyIpFilterJButton.addActionListener(this);
  15. this.modifyIpFilterJButton.addFocusListener(this);
  16. this.removeIpFilterJButton.setToolTipText("Remove IP Filter");
  17. this.removeIpFilterJButton.addActionListener(this);
  18. this.removeIpFilterJButton.addFocusListener(this);
  19. this.addPermissionJButton.setToolTipText("Add Permission");
  20. this.addPermissionJButton.addActionListener(this);
  21. this.addPermissionJButton.addFocusListener(this);
  22. this.modifyPermissionJButton.setToolTipText("Modify Permission");

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

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

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

  1. b1 = new JButton("Start");// The JButton name.
  2. b1.setRequestFocusEnabled(false);
  3. b1.addFocusListener(this);
  4. b1.setLocation(10, 12);
  5. panel.add(b1);
  6. b2.addFocusListener(this);
  7. b2.setLocation(70, 12);
  8. panel.add(b2);

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

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

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

  1. button.addFocusListener(this);

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

  1. jColor.addFocusListener(listener);
  2. jColor.setActionCommand(TagsDialogAction.SHOW_COLOR.name());
  3. jColor.addActionListener(listener);
  4. jOK.setActionCommand(TagsDialogAction.OK.name());
  5. jOK.addActionListener(listener);
  6. jOK.addFocusListener(listener);
  7. jCancel.addFocusListener(listener);

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

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

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

  1. viewButton.setRequestFocusEnabled(true);
  2. viewButton.requestFocus();
  3. viewButton.addFocusListener(tlf);

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

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

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

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

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

  1. wwwLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
  2. wwwLabel.setNextFocusableComponent(wikiLabel);
  3. wwwLabel.addFocusListener(new java.awt.event.FocusAdapter() {
  4. public void focusGained(java.awt.event.FocusEvent evt) {
  5. wwwLabelFocusGained(evt);
  6. wikiLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
  7. wikiLabel.setNextFocusableComponent(downloadsLabel);
  8. wikiLabel.addFocusListener(new java.awt.event.FocusAdapter() {
  9. public void focusGained(java.awt.event.FocusEvent evt) {
  10. wikiLabelFocusGained(evt);
  11. downloadsLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
  12. downloadsLabel.setNextFocusableComponent(dynamicContentPane);
  13. downloadsLabel.addFocusListener(new java.awt.event.FocusAdapter() {
  14. public void focusGained(java.awt.event.FocusEvent evt) {
  15. downloadsLabelFocusGained(evt);
  16. backToTopLabel.addFocusListener(new java.awt.event.FocusAdapter() {
  17. public void focusGained(java.awt.event.FocusEvent evt) {
  18. backToTopLabelFocusGained(evt);

相关文章

JButton类方法