Java Code Examples for javax.swing.JFrame#invalidate()
The following examples show how to use
javax.swing.JFrame#invalidate() .
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: ShapeBoard.java From libreveris with 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 File: AbstractWindowRunner.java From netbeans with Apache License 2.0 | 5 votes |
private void ungrayMainWindow() { if (oldGlassPane != null) { JFrame jf = (JFrame) WindowManager.getDefault().getMainWindow(); jf.setGlassPane(oldGlassPane); jf.getGlassPane().setVisible(false); jf.invalidate(); jf.repaint(); } }
Example 3
Source File: EditorOnlyDisplayer.java From netbeans with Apache License 2.0 | 5 votes |
private boolean switchCurrentEditor() { final TopComponent tc = TopComponent.getRegistry().getActivated(); if( null == tc || !TopComponentTracker.getDefault().isEditorTopComponent( tc ) ) return false; final WindowManagerImpl wmi = WindowManagerImpl.getInstance(); final JFrame mainWnd = ( JFrame ) wmi.getMainWindow(); if( SwingUtilities.isDescendingFrom( tc, mainWnd.getContentPane() ) ) return true; JPanel panel = new JPanel( new BorderLayout() ); panel.add( tc, BorderLayout.CENTER ); try { mainWnd.setContentPane( panel ); } catch( IndexOutOfBoundsException e ) { Logger.getLogger(EditorOnlyDisplayer.class.getName()).log(Level.INFO, "Error while switching current editor.", e); //#245541 - something is broken in the component hierarchy, let's try restoring to the default mode SwingUtilities.invokeLater(new Runnable() { @Override public void run() { cancel(false); } }); } mainWnd.invalidate(); mainWnd.revalidate(); mainWnd.repaint(); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { tc.requestFocusInWindow(); } }); return true; }
Example 4
Source File: EditorOnlyDisplayer.java From netbeans with Apache License 2.0 | 5 votes |
public void cancel( boolean restoreFocus ) { if( !isActive() ) return; TopComponent.getRegistry().removePropertyChangeListener( registryListener ); JFrame frame = ( JFrame ) WindowManagerImpl.getInstance().getMainWindow(); frame.setContentPane( originalContentPane ); originalContentPane = null; frame.invalidate(); frame.revalidate(); frame.repaint(); setShowEditorToolbar( originalShowEditorToolbar ); if( restoreFocus ) restoreFocus(); }
Example 5
Source File: ShapeBoard.java From libreveris with 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(); }