final JDialog d = new JDialog(); d.setSize(200,200); d.setLocationRelativeTo(null); d.setVisible(true);
final JDialog frame = new JDialog(parentFrame, frameTitle, true); frame.getContentPane().add(panel); frame.pack(); frame.setVisible(true);
public void about() { aboutBox.setSize(360, 240); aboutBox.setLocation((int)this.getLocation().getX() + 22, (int)this.getLocation().getY() + 22); aboutBox.setResizable(false); aboutBox.setVisible(true); }
public VUMeterMonitor() { vumeter = new VUMeter(); vuMeterPanel = new VUMeterPanel(); vuMeterPanel.setVu(vumeter); vuMeterPanel.start(); vuMeterDialog = new JDialog(); vuMeterDialog.setBounds(100, 100, 100, 400); vuMeterDialog.getContentPane().setLayout(new BorderLayout()); vuMeterDialog.getContentPane().add(vuMeterPanel); vuMeterDialog.setVisible(true); }
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);
placeholderLabel.setBorder(new EmptyBorder(border.getBorderInsets(textField))); JDialog dialog = pane.createDialog(null, title); pane.selectInitialValue(); dialog.setVisible(true); dialog.dispose();
final JDialog dialog = fileFilterDialog.createDialog(null, "Default encoding changed..."); useNewEncoding.addActionListener(arg0 -> { FileTreeModel.setCurEncoding(encoding); 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);
final JDialog dialog = new JDialog(frame, "Jar File Chooser", true); dialog.setLocation(location); final JList fileList = new JList(new Vector<>(files)); okay.setText("Okay"); okay.setToolTipText("Okay"); okay.addActionListener(evt -> dialog.setVisible(false)); JButton cancel = new javax.swing.JButton(); cancel.setText("Cancel"); cancel.addActionListener(evt -> { fileList.clearSelection(); dialog.setVisible(false); }); gridbag.setConstraints(cancel, constraints); dialog.add(cancel); dialog.pack(); dialog.setSize(dialog.getPreferredSize()); dialog.setVisible(true);
@Override public void actionPerformed (ActionEvent arg0) { if(editor.isUsingDefaultTexture()) { JOptionPane.showMessageDialog(editor, "Load a Texture or an Atlas first."); return; } TextureAtlas atlas = editor.getAtlas(); if(atlas != null) regionPickerPanel.setAtlas(atlas); else regionPickerPanel.setTexture(editor.getTexture()); regionPickerPanel.revalidate(); regionPickerPanel.repaint(); regionSelectDialog.validate(); regionSelectDialog.repaint(); regionSelectDialog.pack(); regionSelectDialog.setVisible(true); } });
public void actionPerformed(ActionEvent e) { JOptionPane helpPane = new JOptionPane(helpScroller, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION); JDialog dialog = helpPane.createDialog(HelpButton.this, "Help"); dialog.setResizable(true); dialog.setModal(false); dialog.setSize(dialog.getHeight(), helpScroller.getWidth() + 10); dialog.setVisible(true); }
final JDialog waitForTrans = new JDialog((JFrame) null, true); SwingWorker worker = new SwingWorker() { public String doInBackground() throws Exception { Thread.sleep(5000); return null; } public void done() { SwingUtilities.invokeLater(new Runnable() { public void run() { waitForTrans.setVisible(false); waitForTrans.dispose(); } }); } }; worker.execute(); SwingUtilities.invokeLater(new Runnable() { public void run() { waitForTrans.add(new JLabel("Please Wait...")); waitForTrans.setMinimumSize(new Dimension(300, 100)); waitForTrans.setVisible(true); } });
private void installPlugin(final File plugin) { final JDialog dialog = new JDialog(frame, "Installing Plugin", true); dialog.getContentPane().setLayout(new BorderLayout()); JProgressBar bar = new JProgressBar(); bar.setIndeterminate(true); bar.setString("Installing Plugin. Please wait..."); bar.setStringPainted(true); dialog.getContentPane().add(bar, BorderLayout.CENTER); dialog.pack(); dialog.setSize(225, 55); 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(); }
placeholderLabel.setBorder(new EmptyBorder(border.getBorderInsets(textField))); JDialog dialog = pane.createDialog(null, title); pane.selectInitialValue(); dialog.setVisible(true); dialog.dispose();
final JDialog d = new JDialog(); d.setSize(200, 200); final Toolkit toolkit = Toolkit.getDefaultToolkit(); final Dimension screenSize = toolkit.getScreenSize(); final int x = (screenSize.width - d.getWidth()) / 2; final int y = (screenSize.height - d.getHeight()) / 2; d.setLocation(x, y); d.setVisible(true);
final JDialog dialog = fileFilterDialog.createDialog(null, "Set file filters..."); okay.addActionListener(arg0 -> { 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);
@Override public void actionPerformed (ActionEvent arg0) { if(editor.isUsingDefaultTexture()) { JOptionPane.showMessageDialog(editor, "Load a Texture or an Atlas first."); return; } TextureAtlas atlas = editor.getAtlas(); if(atlas != null) regionPickerPanel.setAtlas(atlas); else regionPickerPanel.setTexture(editor.getTexture()); regionPickerPanel.revalidate(); regionPickerPanel.repaint(); regionSelectDialog.validate(); regionSelectDialog.repaint(); regionSelectDialog.pack(); regionSelectDialog.setVisible(true); } });
JDialog dialog = new JDialog(SwingUtilities.windowForComponent(this)); dialog.setModal(true); dialog.setSize(...); dialog.setVisible( true );
public void actionPerformed(ActionEvent e) { JOptionPane helpPane = new JOptionPane(helpScroller, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION); JDialog dialog = helpPane.createDialog(HelpButton.this, "Help"); dialog.setResizable(true); dialog.setModal(false); dialog.setSize(dialog.getHeight(), helpScroller.getWidth() + 10); dialog.setVisible(true); }
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; }