Java Code Examples for java.awt.Dialog.ModalityType#APPLICATION_MODAL

The following examples show how to use java.awt.Dialog.ModalityType#APPLICATION_MODAL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WhoIsPanel.java    From openvisualtraceroute with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Show a dialog with whois data for the given point
 * @param parent
 * @param whois
 * @param point
 */
public static void showWhoIsDialog(final JComponent parent, final ServiceFactory services, final GeoPoint point) {
	final WhoIsPanel panel = new WhoIsPanel(services);
	final JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(parent), "Who is " + point.getIp(), ModalityType.APPLICATION_MODAL) {

		private static final long serialVersionUID = 1258611715478157956L;

		@Override
		public void dispose() {
			panel.dispose();
			super.dispose();
		}

	};
	dialog.getContentPane().add(panel, BorderLayout.CENTER);
	final JPanel bottom = new JPanel();
	final JButton close = new JButton(Resources.getLabel("close.button"));
	close.addActionListener(e -> dialog.dispose());
	bottom.add(close);
	dialog.getContentPane().add(bottom, BorderLayout.SOUTH);
	services.getWhois().whoIs(point.getIp());
	SwingUtilities4.setUp(dialog);
	dialog.setVisible(true);

}
 
Example 2
Source File: EncryptBackMultipleView.java    From pgptool with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected JDialog initDialog(Window owner, Object constraints) {
	JDialog ret = new JDialog(owner, ModalityType.APPLICATION_MODAL);
	ret.setLayout(new BorderLayout());
	ret.setResizable(false);
	ret.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	ret.setTitle(Messages.get("encrypBackMany.action"));
	ret.add(pnl, BorderLayout.CENTER);
	ret.pack();
	UiUtils.centerWindow(ret, owner);
	{
		// DIRTY-HACK: YES, FOLLOWING 2 LINES ARE REPEATED BY INTENTION,
		// OTHERWISE JXlABEL IS NOT
		// RETURNING CORRECT PREFERRED SIZE AND WHOLE LAYOUT IS SCREWED UP
		// THE ONLY WAY TO FORCE IT IS TO CENTER WINDOW. SO ONCE WE DID
		// FIRST TIME NOW WE CAN PACK AND CENTER AGAIN
		ret.pack();
		UiUtils.centerWindow(ret, owner);
	}
	return ret;
}
 
Example 3
Source File: MacroEditor.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
public static void showMacroEditorDialog(final ProcessContext context) {
	ButtonDialog dialog = new ButtonDialog(ApplicationFrame.getApplicationFrame(), "define_macros",
			ModalityType.APPLICATION_MODAL, new Object[] {}) {

		private static final long serialVersionUID = 2874661432345426452L;

		{
			MacroEditor editor = new MacroEditor(false);
			editor.setBorder(createBorder());
			JButton addMacroButton = new JButton(editor.ADD_MACRO_ACTION);
			JButton removeMacroButton = new JButton(editor.REMOVE_MACRO_ACTION);
			layoutDefault(editor, NORMAL, addMacroButton, removeMacroButton, makeOkButton());
		}

		@Override
		protected void ok() {
			super.ok();
		}
	};
	dialog.setVisible(true);
}
 
Example 4
Source File: FlatWindowDecorationsTest.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
private void openDialog() {
	Window owner = SwingUtilities.windowForComponent( this );
	JDialog dialog = new JDialog( owner, "Dialog", ModalityType.APPLICATION_MODAL );
	dialog.add( new FlatWindowDecorationsTest() );
	dialog.pack();
	dialog.setLocationRelativeTo( this );
	dialog.setVisible( true );
}
 
Example 5
Source File: CreateKeyView.java    From pgptool with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected JDialog initDialog(Window owner, Object constraints) {
	JDialog ret = new JDialog(owner, ModalityType.APPLICATION_MODAL);
	ret.setLayout(new BorderLayout());
	ret.setResizable(false);
	ret.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	ret.setTitle(Messages.get("action.createPgpKey"));
	ret.add(pnl, BorderLayout.CENTER);
	ret.pack();
	UiUtils.centerWindow(ret, owner);
	return ret;
}
 
Example 6
Source File: KeyImporterView.java    From pgptool with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected JDialog initDialog(Window owner, Object constraints) {
	JDialog ret = new JDialog(owner, ModalityType.APPLICATION_MODAL);
	ret.setLayout(new BorderLayout());
	ret.setResizable(true);
	ret.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	ret.setTitle(Messages.get("action.importKey"));
	ret.add(pnl, BorderLayout.CENTER);
	ret.setMinimumSize(new Dimension(spacing(60), spacing(30)));

	initWindowGeometryPersister(ret, "keyImprt");

	return ret;
}
 
Example 7
Source File: CheckForUpdatesView.java    From pgptool with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected JDialog initDialog(Window owner, Object constraints) {
	JDialog ret = new JDialog(owner, ModalityType.APPLICATION_MODAL);
	ret.setLayout(new BorderLayout());
	ret.setResizable(false);
	ret.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	ret.setTitle(text("action.checkForUpdates"));
	ret.add(pnl, BorderLayout.CENTER);
	ret.pack();
	UiUtils.centerWindow(ret, owner);
	return ret;
}
 
Example 8
Source File: AboutView.java    From pgptool with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected JDialog initDialog(Window owner, Object constraints) {
	JDialog ret = new JDialog(owner, ModalityType.APPLICATION_MODAL);
	ret.setLayout(new BorderLayout());
	ret.setResizable(false);
	ret.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	ret.setTitle(Messages.get("term.aboutApp"));
	ret.add(pnl, BorderLayout.CENTER);
	ret.pack();
	return ret;
}
 
Example 9
Source File: KeysListView.java    From pgptool with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected JDialog initDialog(Window owner, Object constraints) {
	JDialog ret = new JDialog(owner, ModalityType.APPLICATION_MODAL);
	ret.setMinimumSize(new Dimension(spacing(50), spacing(25)));
	ret.setLayout(new BorderLayout());
	ret.setResizable(true);
	ret.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	ret.setTitle(Messages.get("term.keysList"));
	ret.add(panelRoot, BorderLayout.CENTER);
	ret.setJMenuBar(menuBar);
	initWindowGeometryPersister(ret, "keysList");
	return ret;
}
 
Example 10
Source File: UIUtilities.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/** @return Whether or not the application is currently in a modal state. */
public static boolean inModalState() {
    for (Window window : Window.getWindows()) {
        if (window instanceof Dialog) {
            Dialog dialog = (Dialog) window;
            if (dialog.isShowing()) {
                ModalityType type = dialog.getModalityType();
                if (type == ModalityType.APPLICATION_MODAL || type == ModalityType.TOOLKIT_MODAL) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example 11
Source File: ExtendedJFileChooser.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
public FileChooserButtonDialog(Window owner, String key, boolean modal, ExtendedJFileChooser chooser,
		Object... arguments) {
	super(owner, key, modal ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS, arguments);
	chooser.setControlButtonsAreShown(false);
	layoutDefault(chooser, NORMAL, getButtons());
}