Java Code Examples for javax.swing.JFrame#validate()
The following examples show how to use
javax.swing.JFrame#validate() .
These examples are extracted from open source projects.
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 Project: libreveris File: ShapeBoard.java License: GNU Lesser General Public License v3.0 | 6 votes |
@Override public void actionPerformed (ActionEvent e) { // Remove current panel of shapes getBody() .remove(shapesPanel); // Replace by panel of ranges getBody() .add(rangesPanel); // Perhaps this is too much ... TODO JFrame frame = Main.getGui() .getFrame(); frame.invalidate(); frame.validate(); frame.repaint(); }
Example 2
Source Project: jintellitype File: JIntellitypeDemo.java License: Apache License 2.0 | 5 votes |
/** * Centers window on desktop. * <p> * * @param aFrame the Frame to center */ private static void center(JFrame aFrame) { final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); final Point centerPoint = ge.getCenterPoint(); final Rectangle bounds = ge.getMaximumWindowBounds(); final int w = Math.min(aFrame.getWidth(), bounds.width); final int h = Math.min(aFrame.getHeight(), bounds.height); final int x = centerPoint.x - (w / 2); final int y = centerPoint.y - (h / 2); aFrame.setBounds(x, y, w, h); if ((w == bounds.width) && (h == bounds.height)) { aFrame.setExtendedState(Frame.MAXIMIZED_BOTH); } aFrame.validate(); }
Example 3
Source Project: filthy-rich-clients File: DataBufferGrabber.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
private static void createAndShowGUI() { JFrame f = new JFrame("DataBufferGrabber"); f.getContentPane().setLayout(new FlowLayout()); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(100, 100); f.add(new DataBufferGrabber()); f.validate(); f.pack(); f.setVisible(true); }
Example 4
Source Project: filthy-rich-clients File: ScalingMethods.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
private static void createAndShowGUI() { JFrame f = new JFrame("ScalingMethods"); f.setLayout(new BorderLayout()); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ScalingMethods test = new ScalingMethods(); f.add(test); f.validate(); f.pack(); f.setVisible(true); }
Example 5
Source Project: filthy-rich-clients File: PictureScaler.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
private static void createAndShowGUI() { JFrame f = new JFrame(); f.setLayout(new BorderLayout()); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); PictureScaler test = new PictureScaler(); //f.setSize(scaleW + (4 * PADDING), scaleH + (4 * PADDING)); f.add(test); f.validate(); f.pack(); f.setVisible(true); }
Example 6
Source Project: libreveris File: ShapeBoard.java License: GNU Lesser General Public License v3.0 | 5 votes |
@Override public void actionPerformed (ActionEvent e) { // Remove panel of ranges getBody() .remove(rangesPanel); // Replace by proper panel of range shapes String rangeName = ((JButton) e.getSource()).getName(); ShapeSet range = ShapeSet.getShapeSet(rangeName); shapesPanel = shapesPanels.get(range); if (shapesPanel == null) { // Lazily populate the map of shapesPanel instances shapesPanels.put(range, shapesPanel = defineShapesPanel(range)); } getBody() .add(shapesPanel); // Perhaps this is too much ... TODO JFrame frame = Main.getGui() .getFrame(); frame.invalidate(); frame.validate(); frame.repaint(); }