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);
JDialog dialog = new JDialog (); dialog.setModal (true); dialog.setAlwaysOnTop (true); dialog.setModalityType (ModalityType.APPLICATION_MODAL);
dialog.setModal(true); dialog.setAlwaysOnTop(true); dialog.setVisible(true);
dialog.setModal(true); dialog.setAlwaysOnTop(true); dialog.setVisible(true);
/** A little test-function which plugs a microphone directly into the vu-meter. * @param args arguments to use * @throws edu.cmu.sphinx.frontend.DataProcessingException if error occurs */ public static void main(String[] args) throws DataProcessingException { Microphone mic = new Microphone( 16000, 16, 1, true, true, true, 10, false, "selectChannel", 2, "default", 6400); mic.initialize(); mic.startRecording(); VUMeterMonitor monitor = new VUMeterMonitor(); monitor.getVuMeterDialog().setModal(true); monitor.setPredecessor(mic); while (true) { monitor.getData(); } } }
JDialog dialog = new JDialog(SwingUtilities.windowForComponent(this)); dialog.setModal(true); dialog.setSize(...); dialog.setVisible( true );
/** * Sets the modality of the generated javax.swing.JDialog. * @param b the modality of the dialog */ public void setModal(boolean b) { wizardDialog.setModal(b); }
/** * Sets the modality of the generated javax.swing.JDialog. * @param b the modality of the dialog */ public void setModal(boolean b) { wizardDialog.setModal(b); }
/** * Sets the modality of the generated javax.swing.JDialog. * @param b the modality of the dialog */ public void setModal(boolean b) { wizardDialog.setModal(b); }
JDialog dialog = new JDialog(your_frame_reference, "Licence"); dialog .setModal(true); dialog .setLocationRelativeTo(null); dialog. getContentPane().add(new JLabel(your_text); dialog .setVisible(true);
@Override public void actionPerformed(ActionEvent e) { JDialog dlg = new JDialog(jf, "modal"); dlg.add(new JLabel("hello")); dlg.setModal(true); dlg.pack(); dlg.setLocationRelativeTo(canvas); dlg.setVisible(true); button.getModel().setRollover(false); }
/** * Convienence method that displays a modal wizard dialog and blocks until the dialog * has completed. * @return Indicates how the dialog was closed. Compare this value against the RETURN_CODE * constants at the beginning of the class. */ public int showModalDialog() { wizardDialog.setModal(true); wizardDialog.pack(); wizardDialog.show(); return returnCode; }
JButton nextButton = new JButton("Next"); nextButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JDialog dialog = new JDialog(); dialog.setTitle("Title"); dialog.setModal(true); dialog.getContentPane().add(...); // add components here dialog.pack(); dialog.setVisible(true); }
public void showProperties(Node[] nodes) { PropertySheet ps = new PropertySheet(); ps.setNodes(nodes); JDialog d = new JDialog(); d.setTitle("Properties"); // XXX I18N d.setModal(true); d.getContentPane().setLayout(new BorderLayout()); d.getContentPane().add(ps, BorderLayout.CENTER); d.pack(); d.setVisible(true); d.dispose(); }
JOptionPane pane = new JOptionPane(arguments); pane.set.Xxxx(...); // Configure JDialog dialog = pane.createDialog(parentComponent, title); dialog.setLocation(....); // added! dialog.setModal(....); // added! Do you want it modal or not? // .... dialog.setVisible(true);
JDialog getModalDialog() { if (modalDialog == null) { modalDialog = new JDialog(); ImageIcon ii = new ImageIcon(GUIImages.CALENDAR); modalDialog.setIconImage(ii.getImage()); modalDialog.add(this); modalDialog.pack(); modalDialog.setResizable(false); modalDialog.setModal(true); } return modalDialog; }
JDialog jd=new JDialog(loginpage.this,"User Registration"); jd.setModal(true); jd.setLayout(null); // THIS IS A BAD IDEA // jd.setLocationRelativeTo(null); // This is somewhat pointless, you've set relative location, but know overridden it... // You should also be relying on the layout manager and pack to determine the size... jd.setBounds(400,300, 479, 329); jd.setResizable(false); setLocationRelativeTo(loginpage.this); // Add you other components jd.setVisible(true);
public static void showNonModalMessage(Component parent, String title, String message, int type, boolean allowHtml) { if (!allowHtml) { message = Helper.htmlspecialchars_encode(message); } message = "<html><body style='font-family: Monospaced;width:400px;'>"+message; JOptionPane pane = new JOptionPane(message, type); JDialog dialog = pane.createDialog(parent, title); dialog.setModal(false); dialog.setVisible(true); }
public void actionPerformed(ActionEvent e) { BiomobyActionHelper helper = new BiomobyActionHelper(); Dimension size = helper.getFrameSize(); Component component = helper.getComponent(activity); final JDialog dialog = new JDialog(owner, false); dialog.getContentPane().add(component); dialog.pack(); dialog.setTitle(helper.getDescription()); dialog.setSize(size); dialog.setModal(false); dialog.setVisible(true); }
public static JDialog createCancelDialog(final Component component, final String titel, final String text) { final String[] options = { TextUtils.getText("cancel") }; final JOptionPane infoPane = new JOptionPane(text, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, options); JDialog dialog = infoPane.createDialog(component, titel); dialog.setModal(false); return dialog; }