JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(regionPickerPanel); regionSelectDialog.setContentPane(scrollPane); regionSelectDialog.setDefaultCloseOperation( JDialog.HIDE_ON_CLOSE);
JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(regionPickerPanel); regionSelectDialog.setContentPane(scrollPane); regionSelectDialog.setDefaultCloseOperation( JDialog.HIDE_ON_CLOSE);
final JOptionPane optionPane = new JOptionPane("Hello world", JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[]{}, null); final JDialog dialog = new JDialog(); dialog.setTitle("Message"); dialog.setModal(true); dialog.setContentPane(optionPane); dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); dialog.pack(); //create timer to dispose of dialog after 5 seconds Timer timer = new Timer(5000, new AbstractAction() { @Override public void actionPerformed(ActionEvent ae) { dialog.dispose(); } }); timer.setRepeats(false);//the timer should only go off once //start timer to close JDialog as dialog modal we must start the timer before its visible timer.start(); dialog.setVisible(true);
private void showProgressPanel(List<ComponentDescription> comps, boolean install) { final ProgressPanel pp = new ProgressPanel(comps, install); final JOptionPane optionPane = new JOptionPane(pp, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new String[] { "Abort" }, "Abort"); // optionPane.setPreferredSize(new Dimension(640,480)); final JDialog dialog = new JDialog((Frame) null, "Progress", false); 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))) { pp.requestExit(); dialog.setVisible(false); } } }); dialog.pack(); dialog.setVisible(true); new Thread(pp).start(); }
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()); }
private void showProgressPanel(List<ComponentDescription> comps, boolean install) { final ProgressPanel pp = new ProgressPanel(comps, install); final JOptionPane optionPane = new JOptionPane(pp, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new String[] { "Abort" }, "Abort"); // optionPane.setPreferredSize(new Dimension(640,480)); final JDialog dialog = new JDialog((Frame) null, "Progress", false); 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))) { pp.requestExit(); dialog.setVisible(false); } } }); dialog.pack(); dialog.setVisible(true); new Thread(pp).start(); }
private void miProxy1ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_miProxy1ActionPerformed ProxyPanel prp = new ProxyPanel(System.getProperty("http.proxyHost"), System.getProperty("http.proxyPort")); final JOptionPane optionPane = new JOptionPane(prp, JOptionPane.PLAIN_MESSAGE, JOptionPane.YES_NO_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())) { System.setProperty("http.proxyHost", prp.getProxyHost()); System.setProperty("http.proxyPort", prp.getProxyPort()); } }// GEN-LAST:event_miProxy1ActionPerformed
private void miProxy1ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_miProxy1ActionPerformed ProxyPanel prp = new ProxyPanel(System.getProperty("http.proxyHost"), System.getProperty("http.proxyPort")); final JOptionPane optionPane = new JOptionPane(prp, JOptionPane.PLAIN_MESSAGE, JOptionPane.YES_NO_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())) { System.setProperty("http.proxyHost", prp.getProxyHost()); System.setProperty("http.proxyPort", prp.getProxyPort()); } }// GEN-LAST:event_miProxy1ActionPerformed
optionPane.setPreferredSize(new Dimension(800, 600)); final JDialog dialog = new JDialog((Frame) null, "Do you accept the following license?", true); dialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) {
@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; } });
optionPane.setPreferredSize(new Dimension(800, 600)); final JDialog dialog = new JDialog((Frame) null, "Do you accept the following license?", true); dialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) {
@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; } });
new float[]{0f, 0.3f, 1f}, new Color[]{new Color(0.8f, 0.8f, 1f), new Color(0.7f, 0.7f, 1f), new Color(0.6f, 0.6f, 1f)}); dialog.setContentPane(panel); dialog.setVisible(true);
setContentPane(optionPane);
setContentPane(new BackgroundPanel());
this.setContentPane(pnl); this.pack(); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
JDialog dialog = new JDialog(); JPanel reallyComplexPanel = new JPanel(new BorderLayout()); // add in stuff here, e.g buttons at the bottom Something mySomething = new Something(); reallyComplexPanel .add(mySomething, BorderLayout.NORTH); // my stuff at the top dialog.setContentPane(reallyComplexPanel);
/** * Constructs a ProgressDialog. A ProgressDialog contains a message and an optional sub-message. */ public ProgressDialog() { dlg.setUndecorated(true); JPanel contentPane = new JPanel(); contentPane.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.LIGHT_GRAY)); dlg.setContentPane(contentPane); contentPane.setLayout(new BorderLayout()); contentPane.add(view.asJComponent(), BorderLayout.NORTH); }
/** * Constructs a ProgressDialog. A ProgressDialog contains a message and an optional sub-message. */ public ProgressDialog() { dlg.setUndecorated(true); JPanel contentPane = new JPanel(); contentPane.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.LIGHT_GRAY)); dlg.setContentPane(contentPane); contentPane.setLayout(new BorderLayout()); contentPane.add(view.asJComponent(), BorderLayout.NORTH); }
private static JDialog newChartDialog(JFreeChart chart, String title, boolean modal) { chart.setTitle(title); JDialog dialog = new JDialog(); dialog.setTitle(title); dialog.setContentPane(new ChartPanel(chart)); dialog.setModal(modal); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); return dialog; } }