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

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

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

JButton.requestFocusInWindow介绍

暂无

代码示例

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

  1. private void customInitComponents() {
  2. bUpdate.requestFocusInWindow();
  3. // Set up the authentication dialog in case it will be used:
  4. Authenticator.setDefault(new Authenticator() {
  5. @Override
  6. protected PasswordAuthentication getPasswordAuthentication() {
  7. PasswordPanel passP = new PasswordPanel();
  8. final JOptionPane optionPane = new JOptionPane(passP, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION,
  9. null, new String[] { "OK", "Cancel" }, "OK");
  10. final JDialog dialog = new JDialog((Frame) null, "", true);
  11. dialog.setContentPane(optionPane);
  12. optionPane.addPropertyChangeListener(new PropertyChangeListener() {
  13. public void propertyChange(PropertyChangeEvent e) {
  14. String prop = e.getPropertyName();
  15. if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) {
  16. dialog.setVisible(false);
  17. }
  18. }
  19. });
  20. dialog.pack();
  21. dialog.setVisible(true);
  22. if ("OK".equals(optionPane.getValue())) {
  23. return new PasswordAuthentication(passP.getUser(), passP.getPassword());
  24. }
  25. return null;
  26. }
  27. });
  28. }

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

  1. private void customInitComponents() {
  2. bUpdate.requestFocusInWindow();
  3. // Set up the authentication dialog in case it will be used:
  4. Authenticator.setDefault(new Authenticator() {
  5. @Override
  6. protected PasswordAuthentication getPasswordAuthentication() {
  7. PasswordPanel passP = new PasswordPanel();
  8. final JOptionPane optionPane = new JOptionPane(passP, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION,
  9. null, new String[] { "OK", "Cancel" }, "OK");
  10. final JDialog dialog = new JDialog((Frame) null, "", true);
  11. dialog.setContentPane(optionPane);
  12. optionPane.addPropertyChangeListener(new PropertyChangeListener() {
  13. public void propertyChange(PropertyChangeEvent e) {
  14. String prop = e.getPropertyName();
  15. if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) {
  16. dialog.setVisible(false);
  17. }
  18. }
  19. });
  20. dialog.pack();
  21. dialog.setVisible(true);
  22. if ("OK".equals(optionPane.getValue())) {
  23. return new PasswordAuthentication(passP.getUser(), passP.getPassword());
  24. }
  25. return null;
  26. }
  27. });
  28. }

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

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

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

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

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

  1. /**
  2. * Set back default setting for About frame.
  3. */
  4. public final void reinit() {
  5. this.scrollPane.scrollPane.getViewport().setViewPosition(new Point(0, 0));
  6. this.setSize(460, 300);
  7. this.setLocationRelativeTo(MediatorGui.frame());
  8. this.buttonClose.requestFocusInWindow();
  9. this.getRootPane().setDefaultButton(this.buttonClose);
  10. }

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

  1. public void init() {
  2. setContentPane(panel1);
  3. setModal(true);
  4. generateButton.addActionListener(e -> {
  5. setEnabled(false);
  6. java.util.List<String> items = new ArrayList<>();
  7. for (ServiceParameter serviceParameter : modelList.getItems()) {
  8. items.add(serviceParameter.getCurrentService());
  9. }
  10. callback.onOk(items);
  11. dispose();
  12. });
  13. generateButton.requestFocusInWindow();
  14. this.getRootPane().setDefaultButton(generateButton);
  15. this.closeButton.addActionListener(e -> onCancel());
  16. this.getRootPane().registerKeyboardAction(e ->
  17. onCancel(),
  18. KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
  19. JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
  20. );
  21. }

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

  1. this.buttonInsert.setVisible(true);
  2. this.buttonInsert.requestFocusInWindow();
  3. this.getRootPane().setDefaultButton(buttonInsert);

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

  1. /**
  2. * Requests that the selected day also have the focus.
  3. */
  4. public void setFocus() {
  5. if (selectedDay != null) {
  6. selectedDay.requestFocusInWindow();
  7. }
  8. }

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

  1. @Override
  2. public void focus() {
  3. button.requestFocusInWindow();
  4. }
  5. }

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

  1. @Override
  2. public void keyReleased(KeyEvent e) {
  3. if (e.getKeyCode() == KeyEvent.VK_ENTER) {
  4. jbLaunch.requestFocusInWindow();
  5. }
  6. }
  7. });

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

  1. //...Where initialization occurs...
  2. JFrame frame = new JFrame("Test");
  3. JPanel panel = new JPanel(new BorderLayout());
  4. //...Create a variety of components here...
  5. //Create the component that will have the initial focus.
  6. JButton button = new JButton("I am first");
  7. panel.add(button);
  8. frame.getContentPane().add(panel); //Add it to the panel
  9. frame.pack(); //Realize the components.
  10. //This button will have the initial focus.
  11. button.requestFocusInWindow();
  12. frame.setVisible(true); //Display the window.

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

  1. //...Where initialization occurs...
  2. JFrame frame = new JFrame("Test");
  3. JPanel panel = new JPanel(new BorderLayout());
  4. //...Create a variety of components here...
  5. //Create the component that will have the initial focus.
  6. JButton button = new JButton("I am first");
  7. panel.add(button);
  8. frame.getContentPane().add(panel); //Add it to the panel
  9. frame.pack(); //Realize the components.
  10. //This button will have the initial focus.
  11. button.requestFocusInWindow();
  12. frame.setVisible(true); //Display the window.

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

  1. public void keyPressed(KeyEvent e) {
  2. int key = e.getKeyCode();
  3. if (key == KeyEvent.VK_ENTER) {
  4. install.requestFocusInWindow();
  5. install.doClick();
  6. }
  7. }
  8. });

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

  1. private void showMaryXMLMenuItemItemStateChanged(java.awt.event.ItemEvent evt) {// GEN-FIRST:event_showMaryXMLMenuItemItemStateChanged
  2. if (evt.getStateChange() == java.awt.event.ItemEvent.SELECTED) { // new item selected
  3. jScrollPane1.setVisible(true);
  4. lProsodyXML.setVisible(true);
  5. } else { // deselected
  6. jScrollPane1.setVisible(false);
  7. lProsodyXML.setVisible(false);
  8. bPlay.requestFocusInWindow();
  9. }
  10. }// GEN-LAST:event_showMaryXMLMenuItemItemStateChanged

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

  1. @Override
  2. public void afterShow() {
  3. getFinishButton().requestFocusInWindow();
  4. getFinishButton().setEnabled(true);
  5. }

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

  1. private void checkStartATMISP() {
  2. if (fitterResult != null
  3. && chnFile != null
  4. && fitterResult.contains("Design fits successfully")) {
  5. startATMISPAction.setEnabled(true);
  6. } else
  7. startATMISPAction.setEnabled(false);
  8. okButton.requestFocusInWindow();
  9. }

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

  1. public void keyReleased(KeyEvent e) {
  2. if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
  3. if (!expectingInput) {
  4. clearFailure(true);
  5. indicateSearchType();
  6. }
  7. fireSearchEvent(SearchEvent.Type.DISMISSED);
  8. // Send the focus away from the text field.
  9. typesButton.requestFocusInWindow();
  10. }
  11. }

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

  1. private void showPowerMenuItemItemStateChanged(java.awt.event.ItemEvent evt) {// GEN-FIRST:event_showPowerMenuItemItemStateChanged
  2. if (evt.getStateChange() == java.awt.event.ItemEvent.SELECTED) { // new item selected
  3. ftPanel.setShowPower(true);
  4. } else { // deselected
  5. ftPanel.setShowPower(false);
  6. bPlay.requestFocusInWindow();
  7. }
  8. ftPanel.verifyPowerVisible();
  9. verifyPowerVisible();
  10. }// GEN-LAST:event_showPowerMenuItemItemStateChanged

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

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

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

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

相关文章

JButton类方法