Java Code Examples for javax.swing.JDialog#setAlwaysOnTop()
The following examples show how to use
javax.swing.JDialog#setAlwaysOnTop() .
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: OurDialog.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Helper method for constructing an always-on-top modal dialog. */ private static Object show(JFrame parent, String title, int type, Object message, Object[] options, Object initialOption) { if (options == null) { options = new Object[] { "Ok" }; initialOption = "Ok"; } JOptionPane p = new JOptionPane(message, type, JOptionPane.DEFAULT_OPTION, null, options, initialOption); p.setInitialValue(initialOption); JDialog d = p.createDialog(parent, title); p.selectInitialValue(); d.setAlwaysOnTop(true); d.setVisible(true); d.dispose(); return p.getValue(); }
Example 2
Source File: ImportAltsFileChooser.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override protected JDialog createDialog(Component parent) throws HeadlessException { JDialog dialog = super.createDialog(parent); dialog.setAlwaysOnTop(true); return dialog; }
Example 3
Source File: EventLogPopup.java From arcusplatform with Apache License 2.0 | 5 votes |
@Override protected Window createComponent() { JDialog window = new JDialog(null, "Event Log", ModalityType.MODELESS); window.setAlwaysOnTop(false); window.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); // TODO remember dimensions window.setSize(800, 600); window.add(this.log.getComponent()); return window; }
Example 4
Source File: OurDialog.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * Popup the given informative message, then ask the user to click Close to * close it. */ public static void showmsg(String title, Object... msg) { JButton dismiss = new JButton(Util.onMac() ? "Dismiss" : "Close"); Object[] objs = new Object[msg.length + 1]; System.arraycopy(msg, 0, objs, 0, msg.length); objs[objs.length - 1] = OurUtil.makeH(null, dismiss, null); JOptionPane about = new JOptionPane(objs, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[] {}); JDialog dialog = about.createDialog(null, title); dismiss.addActionListener(Runner.createDispose(dialog)); dialog.setAlwaysOnTop(true); dialog.setVisible(true); dialog.dispose(); }
Example 5
Source File: CapabilityResponsePopUp.java From arcusplatform with Apache License 2.0 | 4 votes |
@Override protected Window createComponent() { JDialog window = new JDialog(null, "Response to " + command, ModalityType.MODELESS); window.setAlwaysOnTop(false); window.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // TODO remember dimensions window.setSize(800, 600); installEscapeCloseOperation(window); response = new JTextPane(); response.setEditable(false); response.setContentType("text/html"); response.setText(text); response.setCaretPosition(0); scroller = new JScrollPane(this.response); form = new FormView(); form.addField( Fields .textFieldBuilder() .notEditable() .labelled("Status") .named("status") .build() ); form.addField( Fields .textFieldBuilder() .notEditable() .labelled("From") .named("from") .build() ); form.addField( Fields .textFieldBuilder() .notEditable() .labelled("Type") .named("type") .build() ); form.addField( new JLabel("Attributes"), scroller, LabelLocation.TOP ); window.add(form.getComponent()); return window; }
Example 6
Source File: POptionPane.java From PolyGlot with MIT License | 4 votes |
public static int internalShowOptionDialog(final Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue) throws HeadlessException { Window parentWindow = internalGetWindowForComponent(parentComponent); boolean parentIsModal = parentWindow instanceof Dialog && ((Dialog)parentWindow).isModal(); int ret = CLOSED_OPTION; POptionPane pane = new POptionPane(message, messageType, optionType, icon, options, initialValue); pane.setInitialValue(initialValue); pane.setComponentOrientation(((parentComponent == null) ? getRootFrame() : parentComponent).getComponentOrientation()); int style = internalStyleFromMessageType(messageType); JDialog dialog = pane.createDialog(parentWindow, parentComponent, title, style); dialog.setAlwaysOnTop(true); dialog.setModal(true); setAllWhite(pane); // prevent locking of application if(parentIsModal) { ((Dialog)parentWindow).setModal(false); } pane.selectInitialValue(); dialog.toFront(); dialog.setVisible(true); dialog.dispose(); Object selectedValue = pane.getValue(); if (selectedValue != null) { if (options != null) { for (int counter = 0, maxCounter = options.length; counter < maxCounter; counter++) { if (options[counter].equals(selectedValue)) { ret = counter; } } } else { if (selectedValue instanceof Integer) { ret = ((Integer) selectedValue); } } } // prevent locking of application if(parentIsModal) { ((Dialog)parentWindow).setModal(true); } return ret; }