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

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

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

JButton.requestFocusInWindow介绍

暂无

代码示例

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

private void customInitComponents() {
  bUpdate.requestFocusInWindow();
  // Set up the authentication dialog in case it will be used:
  Authenticator.setDefault(new Authenticator() {
    @Override
    protected PasswordAuthentication getPasswordAuthentication() {
      PasswordPanel passP = new PasswordPanel();
      final JOptionPane optionPane = new JOptionPane(passP, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION,
          null, new String[] { "OK", "Cancel" }, "OK");
      final JDialog dialog = new JDialog((Frame) null, "", true);
      dialog.setContentPane(optionPane);
      optionPane.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
          String prop = e.getPropertyName();
          if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) {
            dialog.setVisible(false);
          }
        }
      });
      dialog.pack();
      dialog.setVisible(true);
      if ("OK".equals(optionPane.getValue())) {
        return new PasswordAuthentication(passP.getUser(), passP.getPassword());
      }
      return null;
    }
  });
}

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

private void customInitComponents() {
  bUpdate.requestFocusInWindow();
  // Set up the authentication dialog in case it will be used:
  Authenticator.setDefault(new Authenticator() {
    @Override
    protected PasswordAuthentication getPasswordAuthentication() {
      PasswordPanel passP = new PasswordPanel();
      final JOptionPane optionPane = new JOptionPane(passP, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION,
          null, new String[] { "OK", "Cancel" }, "OK");
      final JDialog dialog = new JDialog((Frame) null, "", true);
      dialog.setContentPane(optionPane);
      optionPane.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
          String prop = e.getPropertyName();
          if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) {
            dialog.setVisible(false);
          }
        }
      });
      dialog.pack();
      dialog.setVisible(true);
      if ("OK".equals(optionPane.getValue())) {
        return new PasswordAuthentication(passP.getUser(), passP.getPassword());
      }
      return null;
    }
  });
}

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

public void requestButtonFocus() {
  this.buttonSend.requestFocusInWindow();
}

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

public void requestButtonFocus() {
  this.buttonClose.requestFocusInWindow();
}

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

/**
 * Set back default setting for About frame.
 */
public final void reinit() {
  this.scrollPane.scrollPane.getViewport().setViewPosition(new Point(0, 0));
  this.setSize(460, 300);
  this.setLocationRelativeTo(MediatorGui.frame());
  this.buttonClose.requestFocusInWindow();
  this.getRootPane().setDefaultButton(this.buttonClose);
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

public void init() {
  setContentPane(panel1);
  setModal(true);
  generateButton.addActionListener(e -> {
    setEnabled(false);
    java.util.List<String> items = new ArrayList<>();
    for (ServiceParameter serviceParameter : modelList.getItems()) {
      items.add(serviceParameter.getCurrentService());
    }
    callback.onOk(items);
    dispose();
  });
  generateButton.requestFocusInWindow();
  this.getRootPane().setDefaultButton(generateButton);
  this.closeButton.addActionListener(e -> onCancel());
  this.getRootPane().registerKeyboardAction(e ->
    onCancel(),
    KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
    JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
  );
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

this.buttonInsert.setVisible(true);
this.buttonInsert.requestFocusInWindow();
this.getRootPane().setDefaultButton(buttonInsert);

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

/**
 * Requests that the selected day also have the focus.
 */
public void setFocus() {
  if (selectedDay != null) {
    selectedDay.requestFocusInWindow();
  }
}

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

@Override
  public void focus() {
    button.requestFocusInWindow();
  }
}

代码示例来源:origin: RPTools/maptool

@Override
  public void keyReleased(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_ENTER) {
      jbLaunch.requestFocusInWindow();
    }
  }
});

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

//...Where initialization occurs...
JFrame frame = new JFrame("Test");
JPanel panel = new JPanel(new BorderLayout());

//...Create a variety of components here...

//Create the component that will have the initial focus.
JButton button = new JButton("I am first");
panel.add(button);
frame.getContentPane().add(panel);  //Add it to the panel

frame.pack();  //Realize the components.
//This button will have the initial focus.
button.requestFocusInWindow(); 
frame.setVisible(true); //Display the window.

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

//...Where initialization occurs...
JFrame frame = new JFrame("Test");
JPanel panel = new JPanel(new BorderLayout());

//...Create a variety of components here...

//Create the component that will have the initial focus.
JButton button = new JButton("I am first");
panel.add(button);
frame.getContentPane().add(panel);  //Add it to the panel

frame.pack();  //Realize the components.
//This button will have the initial focus.
button.requestFocusInWindow(); 
frame.setVisible(true); //Display the window.

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

public void keyPressed(KeyEvent e) {
    int key = e.getKeyCode();
    if (key == KeyEvent.VK_ENTER) {
      install.requestFocusInWindow();
      install.doClick();
    }
  }
});

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

private void showMaryXMLMenuItemItemStateChanged(java.awt.event.ItemEvent evt) {// GEN-FIRST:event_showMaryXMLMenuItemItemStateChanged
  if (evt.getStateChange() == java.awt.event.ItemEvent.SELECTED) { // new item selected
    jScrollPane1.setVisible(true);
    lProsodyXML.setVisible(true);
  } else { // deselected
    jScrollPane1.setVisible(false);
    lProsodyXML.setVisible(false);
    bPlay.requestFocusInWindow();
  }
}// GEN-LAST:event_showMaryXMLMenuItemItemStateChanged

代码示例来源:origin: Multibit-Legacy/multibit-hd

@Override
public void afterShow() {
 getFinishButton().requestFocusInWindow();
 getFinishButton().setEnabled(true);
}

代码示例来源:origin: hneemann/Digital

private void checkStartATMISP() {
  if (fitterResult != null
      && chnFile != null
      && fitterResult.contains("Design fits successfully")) {
    startATMISPAction.setEnabled(true);
  } else
    startATMISPAction.setEnabled(false);
  okButton.requestFocusInWindow();
}

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

public void keyReleased(KeyEvent e) {
  if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
    if (!expectingInput) {
      clearFailure(true);
      indicateSearchType();
    }
    fireSearchEvent(SearchEvent.Type.DISMISSED);
    // Send the focus away from the text field.
    typesButton.requestFocusInWindow();
  }
}

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

private void showPowerMenuItemItemStateChanged(java.awt.event.ItemEvent evt) {// GEN-FIRST:event_showPowerMenuItemItemStateChanged
  if (evt.getStateChange() == java.awt.event.ItemEvent.SELECTED) { // new item selected
    ftPanel.setShowPower(true);
  } else { // deselected
    ftPanel.setShowPower(false);
    bPlay.requestFocusInWindow();
  }
  ftPanel.verifyPowerVisible();
  verifyPowerVisible();
}// GEN-LAST:event_showPowerMenuItemItemStateChanged

代码示例来源:origin: Multibit-Legacy/multibit-hd

@Override
public void afterShow() {
 // Leave focus on Next button for consistency
 getNextButton().requestFocusInWindow();
 ViewEvents.fireWizardButtonEnabledEvent(getPanelName(), WizardButton.NEXT, true);
}

代码示例来源:origin: Multibit-Legacy/multibit-hd

@Override
 public void run() {
  // Enable and focus the finish button
  ViewEvents.fireWizardButtonEnabledEvent(getPanelName(), WizardButton.FINISH, true);
  passwordChangedStatusLabel.setText(Languages.safeText(changePasswordResultEvent.getChangePasswordResultKey(), changePasswordResultEvent.getChangePasswordResultData()));
  LabelDecorator.applyStatusIcon(passwordChangedStatusLabel, Optional.of(changePasswordResultEvent.isChangePasswordWasSuccessful()));
  getFinishButton().requestFocusInWindow();
 }
});

相关文章

微信公众号

最新文章

更多

JButton类方法