Refine search
final JDialog d = new JDialog(); d.setSize(200,200); d.setLocationRelativeTo(null); d.setVisible(true);
System.out.println("encoding null!!"); setEncoding.setText(encoding); dialog.setVisible(false); }); useOldEncoding.addActionListener(e -> dialog.setVisible(false)); useAnotherEncoding.addActionListener(e -> { dialog.setVisible(false); alternateEncodingPrompt(encoding); }); dialog.getRootPane().setDefaultButton(useNewEncoding); dialog.pack(); dialog.setLocationRelativeTo(this); dialog.setVisible(true);
protected JDialog createDialog(Component parent) { Frame frame = parent instanceof Frame ? (Frame) parent : (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent); JDialog dialog = new JDialog(frame, ("Select Font"), true); Action okAction = new DialogOKAction(dialog); Action cancelAction = new DialogCancelAction(dialog); JButton okButton = new JButton(okAction); okButton.setFont(DEFAULT_FONT); JButton cancelButton = new JButton(cancelAction); cancelButton.setFont(DEFAULT_FONT); JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout(new GridLayout(2, 1)); buttonsPanel.add(okButton); buttonsPanel.add(cancelButton); buttonsPanel.setBorder(BorderFactory.createEmptyBorder(25, 0, 10, 10)); ActionMap actionMap = buttonsPanel.getActionMap(); actionMap.put(cancelAction.getValue(Action.DEFAULT), cancelAction); actionMap.put(okAction.getValue(Action.DEFAULT), okAction); InputMap inputMap = buttonsPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), cancelAction.getValue(Action.DEFAULT)); inputMap.put(KeyStroke.getKeyStroke("ENTER"), okAction.getValue(Action.DEFAULT)); JPanel dialogEastPanel = new JPanel(); dialogEastPanel.setLayout(new BorderLayout()); dialogEastPanel.add(buttonsPanel, BorderLayout.NORTH); dialog.getContentPane().add(this, BorderLayout.CENTER); dialog.getContentPane().add(dialogEastPanel, BorderLayout.EAST); dialog.pack(); dialog.setLocationRelativeTo(frame); return dialog; }
bar.setStringPainted(true); dialog.getContentPane().add(bar, BorderLayout.CENTER); dialog.pack(); dialog.setSize(225, 55); dialog.setLocationRelativeTo(frame); dialog.setVisible(true);
public void editMetadata() { if (getActiveNode() == null) return; JDialog editorDialog = new NodeAttributesDialog(NodeBoxDocument.this); editorDialog.setSize(580, 751); editorDialog.setLocationRelativeTo(NodeBoxDocument.this); editorDialog.setVisible(true); }
public ConferenceCFPImportWorker(SolutionBusiness<ConferenceSolution> solutionBusiness, SolutionPanel<ConferenceSolution> solutionPanel, String conferenceBaseUrl) { this.solutionBusiness = solutionBusiness; this.solutionPanel = solutionPanel; this.conferenceBaseUrl = conferenceBaseUrl; dialog = new JDialog(solutionPanel.getSolverAndPersistenceFrame(), true); JPanel contentPane = new JPanel(new BorderLayout(10, 10)); contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); contentPane.add(new JLabel("Importing CFP data in progress..."), BorderLayout.NORTH); JProgressBar progressBar = new JProgressBar(SwingConstants.HORIZONTAL); progressBar.setIndeterminate(true); contentPane.add(progressBar, BorderLayout.CENTER); JButton button = new JButton("Cancel"); button.addActionListener(e -> cancel(false)); contentPane.add(button, BorderLayout.SOUTH); dialog.setContentPane(contentPane); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); dialog.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { cancel(false); } }); dialog.pack(); dialog.setLocationRelativeTo(solutionPanel.getSolverAndPersistenceFrame()); }
dialog.setVisible(false); startFileLoadingThread(filters, cFiles); }); add.addActionListener(e -> { fileFilterPanel.add(getNewFilter()); dialog.pack(); }); cancel.addActionListener(e -> dialog.setVisible(false)); dialog.getRootPane().setDefaultButton(okay); dialog.pack(); dialog.setLocationRelativeTo(this); dialog.setVisible(true);
JButton showDialogButton = new JButton("Text Button"); showDialogButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // display/center the jdialog when the button is pressed JDialog d = new JDialog(frame, "Hello", true); d.setLocationRelativeTo(frame); d.setVisible(true); } });
private JDialog createJumpDialog() dialog.setLocationRelativeTo(this); final JLabel nowLabel = new JLabel("Present index: " + selectedIndex); final JLabel label = new JLabel("Index to go:"); contentPanel.add(inputPanel); dialog.getContentPane().add(contentPanel); dialog.pack(); return dialog;
FIND_REPLACE_DIALOG.pack(); FIND_REPLACE_DIALOG.setLocationRelativeTo(frames[i]); FIND_REPLACE_DIALOG.setVisible(true); FIND_FIELD.requestFocusInWindow();
public void run() { progressDialog.setLocationRelativeTo(FlingFrame.this); progressDialog.setTitle(message); progressDialog.setVisible(true); } });
private void centerWindow() { jWindow.pack(); jWindow.setLocationRelativeTo(jWindow.getParent()); }
public int show(JFrame frame) { dialog = new JDialog(frame, "Save Changes", true); Container contentPane = dialog.getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(this, BorderLayout.CENTER); dialog.setResizable(false); dialog.pack(); dialog.setLocationRelativeTo(frame); dialog.getRootPane().setDefaultButton(saveButton); dialog.setVisible(true); dialog.dispose(); return selectedValue; }
public boolean isServerTrusted(String host, X509Certificate cert) { accepted = false; JDialog dlg = createDialog(); //populate the fields messagePane.setText(MessageFormat.format(message, host)); //show the dialog dlg.setLocationRelativeTo(null); dlg.setVisible(true); return accepted; } }
JDialog dialog = new CustomDialog(...); dialog.pack(); dialog.setLocationRelativeTo( parentFrame );
public void display2() { JDialog dialog = new JDialog(null, "Title", ModalityType.APPLICATION_MODAL); dialog.getContentPane().add(this); dialog.pack(); dialog.setLocationRelativeTo(null); txt2.requestFocusInWindow(); dialog.setVisible(true); }
JDialog dialog = new JDialog(your_frame_reference, "Licence"); dialog .setModal(true); dialog .setLocationRelativeTo(null); dialog. getContentPane().add(new JLabel(your_text); dialog .setVisible(true);
public void save(String fileName) throws IOException, PrintException { JDialog dialog = new JDialog(); Container contentPane = dialog.getContentPane(); ((JComponent) contentPane).setBorder(BorderFactory.createEmptyBorder( 10, 10, 10, 10)); contentPane.add(this); contentPane.setBackground(Color.white); dialog.pack(); dialog.setLocationRelativeTo(null); dialog.dispose(); GraphicsSupport.saveImage(this, fileName); }
protected void getFocusBack() { Toolkit.getDefaultToolkit().beep(); super.setVisible(false); super.pack(); super.setLocationRelativeTo(owner); super.setVisible(true); }
private static void showDialog(JDialog dialog) { dialog.setLocationRelativeTo(null); dialog.setVisible(true); dialog.requestFocusInWindow(); }