List of usage examples for javax.swing JFrame getRootPane
@BeanProperty(bound = false, hidden = true, description = "the RootPane object for this frame.") public JRootPane getRootPane()
rootPane
object for this frame. From source file:Main.java
void initUI() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); int i = 1;/*from w ww . jav a2 s . c om*/ for (GraphicsDevice gd : ge.getScreenDevices()) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(createLabel(String.valueOf(i))); frame.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "exit"); frame.getRootPane().getActionMap().put("exit", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { System.exit(0); } }); frame.setLocation(gd.getDefaultConfiguration().getBounds().getLocation()); frame.setUndecorated(true); frame.setExtendedState(frame.getExtendedState() | JFrame.MAXIMIZED_BOTH); frame.setVisible(true); gd.setFullScreenWindow(frame); i++; } }
From source file:edu.ku.brc.ui.UIHelper.java
/** * Changes the Window indicator to shoe that it is modified * @param comp the Dialog/Frame/*from www .j a v a 2 s.co m*/ * @param isModified whether it is modified */ public static void setWindowModified(final Component comp, final boolean isModified) { if (comp != null) { if (comp instanceof JDialog) { //JDialog dlg = (JDialog)comp; //if (isMacOS_10_5_X) //{ // only works on JFrame // dlg.getRootPane().putClientProperty("JComponent.windowModified", isModified ? Boolean.TRUE : Boolean.FALSE); //} else //{ // dlg.setTitle(dlg.getTitle() + "*"); //} } else if (comp instanceof JFrame) { JFrame dlg = (JFrame) comp; if (isMacOS_10_5_X) { dlg.getRootPane().putClientProperty("JComponent.windowModified", isModified ? Boolean.TRUE : Boolean.FALSE); } else { String title; if (isModified) { title = dlg.getTitle() + "*"; } else { title = dlg.getTitle(); if (title.endsWith("*")) { title = StringUtils.chomp(title); } } dlg.setTitle(title); } } } }
From source file:net.team2xh.crt.gui.util.GUIToolkit.java
/** * Adds a frame with a graph of the heap to a window (Substance only) * * @param frame Frame to be decorated.//from w ww.ja va2 s. c om */ public static void enableHeapStatus(JFrame frame) { SubstanceLookAndFeel.setWidgetVisible(frame.getRootPane(), true, SubstanceWidgetType.TITLE_PANE_HEAP_STATUS); }
From source file:org.notebook.gui.widget.GuiUtils.java
/** * Adds the close action with escape key. * /*w w w. j a v a 2 s . c om*/ * @param frame * the frame */ public static void addCloseActionWithEscapeKey(final JFrame frame) { // Handle escape key to close the dialog KeyStroke escape = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false); Action escapeAction = new AbstractAction() { private static final long serialVersionUID = 0L; @Override public void actionPerformed(ActionEvent e) { frame.setVisible(false); } }; frame.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escape, "ESCAPE"); frame.getRootPane().getActionMap().put("ESCAPE", escapeAction); }
From source file:org.notebook.gui.widget.GuiUtils.java
/** * Adds the dispose action with escape key. * //from w ww. ja v a 2 s . co m * @param frame * the frame */ public static void addDisposeActionWithEscapeKey(final JFrame frame) { // Handle escape key to close the dialog KeyStroke escape = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false); Action disposeAction = new AbstractAction() { private static final long serialVersionUID = 0L; @Override public void actionPerformed(ActionEvent e) { frame.dispose(); } }; frame.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escape, "ESCAPE"); frame.getRootPane().getActionMap().put("ESCAPE", disposeAction); }
From source file:org.ut.biolab.medsavant.client.util.ClientMiscUtils.java
/** * Set the title of a window to reflect whether it is saved or not. On Windows and Linux, this appends an asterisk * to the title of an unsaved document; on Mac, it puts a dot inside the close-button. * // w ww .ja v a 2 s.c om * @param f * @param unsaved */ public static void setUnsavedTitle(JFrame f, String title, boolean unsaved) { f.getRootPane().putClientProperty("Window.documentModified", unsaved); if (!MAC && unsaved) { f.setTitle(title + UNSAVED_MARK); } else { f.setTitle(title); } }