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; } }); }
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; } }); }
public void requestButtonFocus() { this.buttonSend.requestFocusInWindow(); }
public void requestButtonFocus() { this.buttonClose.requestFocusInWindow(); }
/** * 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); }
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 ); }
this.buttonInsert.setVisible(true); this.buttonInsert.requestFocusInWindow(); this.getRootPane().setDefaultButton(buttonInsert);
/** * Requests that the selected day also have the focus. */ public void setFocus() { if (selectedDay != null) { selectedDay.requestFocusInWindow(); } }
@Override public void focus() { button.requestFocusInWindow(); } }
@Override public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { jbLaunch.requestFocusInWindow(); } } });
//...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.
//...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.
public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_ENTER) { install.requestFocusInWindow(); install.doClick(); } } });
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
@Override public void afterShow() { getFinishButton().requestFocusInWindow(); getFinishButton().setEnabled(true); }
private void checkStartATMISP() { if (fitterResult != null && chnFile != null && fitterResult.contains("Design fits successfully")) { startATMISPAction.setEnabled(true); } else startATMISPAction.setEnabled(false); okButton.requestFocusInWindow(); }
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(); } }
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
@Override public void afterShow() { // Leave focus on Next button for consistency getNextButton().requestFocusInWindow(); ViewEvents.fireWizardButtonEnabledEvent(getPanelName(), WizardButton.NEXT, true); }
@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(); } });