Java Code Examples for javax.swing.JFrame#getGlassPane()

The following examples show how to use javax.swing.JFrame#getGlassPane() . 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: netbeans   File: ModeResizer.java    License: Apache License 2.0 6 votes vote down vote up
private void start() {
    Toolkit.getDefaultToolkit().addAWTEventListener( this, KeyEvent.KEY_EVENT_MASK );
    TopComponent.getRegistry().addPropertyChangeListener( this );
    
    Window w = SwingUtilities.getWindowAncestor( resizingComponent );
    if( w instanceof JFrame ) {
        frame = ( JFrame ) w;
        oldGlass = frame.getGlassPane();
        glass = new GlassPane( resizingComponent );
        frame.setGlassPane( glass );
        glass.setVisible( true );
        glass.invalidate();
        glass.revalidate();
        glass.repaint();
        glass.refresh();
        
    }
}
 
Example 2
Source Project: ghidra   File: FrontEndTool.java    License: Apache License 2.0 5 votes vote down vote up
public void setBusy(boolean busy) {
	JFrame rootFrame = winMgr.getRootFrame();
	Component glassPane = rootFrame.getGlassPane();
	if (!(glassPane instanceof GGlassPane)) {
		Msg.debug(this, "Found root frame without a GhidraGlassPane registered!");
		return;
	}
	GGlassPane dockingGlassPane = (GGlassPane) glassPane;
	dockingGlassPane.setBusy(busy);
}
 
Example 3
Source Project: netbeans   File: CustomizerProviderImpl.java    License: Apache License 2.0 5 votes vote down vote up
public void run() {
    try {
        JFrame f = (JFrame) WindowManager.getDefault().getMainWindow();
        Component c = f.getGlassPane();
        c.setVisible(show);
        c.setCursor(show ? Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR) : null);
    } catch (NullPointerException npe) {
        Exceptions.printStackTrace(npe);
    }
}
 
Example 4
Source Project: netbeans   File: CustomizerProviderImpl.java    License: Apache License 2.0 5 votes vote down vote up
public void run() {
    try {
        JFrame f = (JFrame) WindowManager.getDefault().getMainWindow();
        Component c = f.getGlassPane();
        c.setVisible(show);
        c.setCursor(show ? Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR) : null);
    } catch (NullPointerException npe) {
        Exceptions.printStackTrace(npe);
    }
}
 
Example 5
Source Project: netbeans   File: PleaseWait.java    License: Apache License 2.0 5 votes vote down vote up
public void install() {
    JFrame frame = (JFrame) WindowManagerImpl.getInstance().getMainWindow();
    oldGlass = frame.getGlassPane();
    if( oldGlass instanceof PleaseWait )
        oldGlass = null;
    frame.setGlassPane( this );
    setVisible(true);
    invalidate();
    revalidate();
    repaint();
    
}
 
Example 6
Source Project: netbeans   File: ProjectUtilities.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
    try {            
        JFrame f = (JFrame)WindowManager.getDefault ().getMainWindow ();
        Component c = f.getGlassPane ();
        c.setVisible ( show );
        c.setCursor (show ? Cursor.getPredefinedCursor (Cursor.WAIT_CURSOR) : null);
    } 
    catch (NullPointerException npe) {
        Exceptions.printStackTrace(npe);
    }
}
 
Example 7
Source Project: ghidra   File: InfiniteProgressPanel.java    License: Apache License 2.0 4 votes vote down vote up
public static void main( String[] args ) {
    
    
    final JFrame frame = new JFrame( "Ticker Test" );
    frame.setSize( 400, 600 );
    final Component originalGlassPane = frame.getGlassPane();
    final InfiniteProgressPanel progressPanel = new InfiniteProgressPanel("Processing request...");
progressPanel.fps = 7;
    progressPanel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked( MouseEvent e ) {                
            //progressPanel.interrupt();
            progressPanel.stop();
            frame.setGlassPane(originalGlassPane);
        }
    } );
    
    
    JPanel mainPanel = new JPanel( new BorderLayout() );
    
    JScrollPane scrollPane = new JScrollPane();
    final JTextArea textArea = new JTextArea( 50, 40 );
    textArea.setText("some text here..." );
    scrollPane.getViewport().add( textArea );
    mainPanel.add( scrollPane, BorderLayout.CENTER );
    
    JButton button = new JButton( "Start" );
    button.addActionListener(new ActionListener() {
        
        public void actionPerformed( ActionEvent event ) {
            frame.setGlassPane(progressPanel);                    
            progressPanel.start();
        }
    } );
    mainPanel.add( button, BorderLayout.SOUTH );
            
    frame.setSize( 400, 400 );
    frame.setLocation( GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint() );
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.getContentPane().add( mainPanel );
    frame.setVisible( true );
}