List of utility methods to do JFrame
void | saveMainWindowLocation(JFrame jfrm, String strPropertiesFilePath, String strPropertiesFileName) This method saves the main window location, size, and state to the properties file. saveMainWindowLocation(jfrm, strPropertiesFilePath, strPropertiesFileName, null); |
void | setBlockAllUserInput(final JFrame frame, final boolean yesNo) set Block All User Input invokeAndWait(new Runnable() { @Override public void run() { frame.getGlassPane().setVisible(yesNo); }); |
void | setCursorFree(JFrame frame) Set cursor to free and enable application input. setCursorFree(frame.getRootPane().getGlassPane()); |
void | setDialogLocation(JFrame frame, JFrame parentFrame) Sets the dialogLocation attribute of the TapUtils class Point location = new Point(); location.x = parentFrame.getLocation().x + parentFrame.getWidth() / 2 - frame.getWidth() / 2; location.y = parentFrame.getLocation().y + parentFrame.getHeight() / 2 - frame.getHeight() / 2; if (location.x < 0) location.x = 0; if (location.y < 0) location.y = 0; frame.setLocation(location); ... |
void | setDirty(JFrame frame, boolean isDirty) set Dirty setDirty(frame.getRootPane(), isDirty); |
void | setEscapeAction(JFrame frame, Action action) Associate a custom action to be called when the Esc key is pressed. setEscapeAction(frame.getRootPane(), action); |
void | setEscapeClosable(JFrame frame) Make a dialog closeable by pressing the Esc key. setEscapeAction(frame.getRootPane(), makeCloseAction(frame)); |
void | setESCCloseable(final JFrame aFrame) makes the JFrame closeable with ESC key. KeyStroke escapeKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false); Action escapeAction = new AbstractAction() { public void actionPerformed(ActionEvent ae) { aFrame.dispose(); }; aFrame.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escapeKeyStroke, "ESCAPE"); aFrame.getRootPane().getActionMap().put("ESCAPE", escapeAction); ... |
void | setFrameBottomRight(final JFrame frame) set Frame Bottom Right GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice defaultScreen = ge.getDefaultScreenDevice(); Rectangle rect = defaultScreen.getDefaultConfiguration().getBounds(); int x = (int) rect.getMaxX() - frame.getWidth(); int y = (int) rect.getMaxY() - frame.getHeight(); frame.setLocation(x, y); |
void | setFramePositon(JFrame inTargetFrame) set Frame Positon Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); Dimension size = inTargetFrame.getSize(); if (d.width >= 640) { inTargetFrame.setLocation((d.width - size.width) / 2, (d.height - size.height) / 2); } else { inTargetFrame.setLocation(0, 0); inTargetFrame.setSize(d); |