dialog.getContentPane().add(progressBar); dialog.pack(); dialog.setModal( false ); dialog.setVisible(true);
import java.awt.Dialog; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class ProductDialog extends JDialog { private static final long serialVersionUID = 1L; public ProductDialog(final JFrame jFrame) { super(jFrame); this.add(new JPanel().add(new JLabel("Test"))); this.setSize(150, 100); this.setModal(true); this.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL); } }
JDialog dialog = new JDialog(parentWindow); dialog.setLocationRelativeTo(button); dialog.setModal(true); dialog.add(newPane("Label in dialog")); dialog.pack();
obj.setModal(modal);
dialog.setVisible(false); dialog.setAlwaysOnTop(true); dialog.setModal(true); dialog.setLayout(new GridLayout(2, 0, 10, 10)); JPanel pane = (JPanel) dialog.getContentPane();
addDialog.setSize(800, 400); addDialog.setLocationRelativeTo(frame); addDialog.setModal(true);
dialog.setModal( true ); dialog.setVisible( true );
import javax.swing.JDialog; import javax.swing.JFrame; public class MyDialog { private JFrame frame = new JFrame(); private JDialog dialog = new JDialog(); public MyDialog() { frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 300); frame.setVisible(true); //dialog = new JDialog(frame, JDialog.ModalityType.TOOLKIT_MODAL); dialog = new JDialog(frame, true); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setModal(true); dialog.setSize(300, 200); dialog.setVisible(true); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { MyDialog dialog = new MyDialog(); } }); } }
import javax.swing.*; import java.awt.*; public class CursorTest { public static void main(String[] args) { JLabel label = new JLabel("Move mouse here for hand cursor"); label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); JOptionPane pane = new JOptionPane(label); pane.setOptions(new Object[]{"OK"}); JFrame parent = new JFrame(); parent.setVisible(true); JDialog dialog = pane.createDialog(parent, "Test Dialog"); dialog.setModal(false); dialog.setVisible(true); } }
/** * Help | About action performed */ public void menuAbout() { BrowserAboutBox dlg = new BrowserAboutBox(this); Dimension dlgSize = dlg.getPreferredSize(); Dimension frmSize = getSize(); Point loc = getLocation(); dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y); dlg.setModal(true); dlg.show(); }
this.setModal(true); // Set the dialog as modal setDefaultCloseOperation(HIDE_ON_CLOSE); setMinimumSize(new Dimension(200, 200));
dialog.setModal(true); dialog.add(sliderPanel, BorderLayout.CENTER); dialog.add(lb, BorderLayout.SOUTH);
JOptionPane pane = new JOptionPane("Message", JOptionPane.INFORMATION_MESSAGE); JDialog dialog = pane.createDialog(null, "Title"); dialog.setModal(false); dialog.setVisible(true);
JOptionPane pane = new JOptionPane("Message", JOptionPane.INFORMATION_MESSAGE); JDialog dialog = pane.createDialog(null, "Title"); dialog.setModal(false); dialog.setVisible(true);
super(); this.r = r; this.setModal(true);
import javax.swing.*; import javax.swing.table.DefaultTableModel; public class TableDataTest extends JDialog { public TableDataTest() { DefaultTableModel model = new DefaultTableModel(); model.addColumn("test1"); model.addColumn("test2"); model.addRow(new String[]{"testrow", "testrow"}); model.addRow(new String[]{"testrow2", "testrow2"}); JTable myTable = new JTable(model); add(new JScrollPane(myTable)); } public static void main(String args[]) { JDialog dlg = new TableDataTest(); dlg.setSize(100, 100); dlg.setModal(true); dlg.setVisible(true); dlg.dispose(); } }
null, options, options[2]); JDialog myDialog = myOptionPane.createDialog(null, "My Test"); myDialog.setModal(true);
final TextField tfInput = new TextField(40); dialog.setModal(true); dialog.setLayout(new BorderLayout()); dialog.add(new Label(message), BorderLayout.WEST);
public static void showMessageDialog(Component parentComponent, String message, String title, int messageType) { final Dialog dialog = new Dialog(getFrame(parentComponent), title); dialog.setModal(true); dialog.setLayout(new BorderLayout()); dialog.add(new Label(message), BorderLayout.CENTER); Panel panel = new Panel(); Button btOk = new Button("OK"); panel.add(btOk); dialog.add(panel, BorderLayout.SOUTH); dialog.pack(); dialog.addWindowListener(windowListener); btOk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { dialog.hide(); } }); dialog.show(); }
dialog.setModal(modal_); //@C1A dialog.setResizable(false); //@C1A