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

The following examples show how to use javax.swing.JFrame#setGlassPane() . 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 want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public void setMainWindow(JFrame window) {
    super.setMainWindow(window);
    
    try {
        if (!GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().isWindowTranslucencySupported(TRANSLUCENT)) return;
    } catch (IllegalComponentStateException e) {
        return;
    }

    window.setOpacity(0.80f);
    
    SimpleClock clock = new SimpleClock();
    window.setGlassPane(clock);
    clock.setVisible(true);
}
 
Example 2
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 3
/**
   Start the OSMMapExtractor.
   @param args Command line arguments: source target.
*/
public static void main(String[] args) {
    try {
        OSMMap map = new OSMMap(new File(args[0]));
        Writer out = new FileWriter(new File(args[1]));
        OSMMapViewer viewer = new OSMMapViewer(map);

        OSMMapExtractor extractor = new OSMMapExtractor(map, viewer, out);
        viewer.addMouseListener(extractor);
        viewer.setPreferredSize(new Dimension(VIEWER_SIZE, VIEWER_SIZE));

        JFrame frame = new JFrame();
        frame.setGlassPane(extractor.getGlass());
        frame.setContentPane(viewer);
        frame.pack();
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
    // CHECKSTYLE:OFF:IllegalCatch
    catch (Exception e) {
        e.printStackTrace();
    }
    // CHECKSTYLE:ON:IllegalCatch
}
 
Example 4
Source Project: ghidra   File: StatusBarTest.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {

	testFrame = new JFrame("StatusBar Test");
	testFrame.setGlassPane(new GGlassPane());
	testFrame.setSize(400, 100);
	statusBar = new StatusBar();
	testFrame.getContentPane().add(statusBar);
	testFrame.setVisible(true);
}
 
Example 5
Source Project: netbeans   File: AbstractWindowRunner.java    License: Apache License 2.0 5 votes vote down vote up
private void ungrayMainWindow() {
    if (oldGlassPane != null) {
        JFrame jf = (JFrame) WindowManager.getDefault().getMainWindow();
        jf.setGlassPane(oldGlassPane);
        jf.getGlassPane().setVisible(false);          
        jf.invalidate();
        jf.repaint();
    }
}
 
Example 6
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 7
private JFrame prepareMainWindow(JFrame splash) {
	JFrame frame = MainFrame.prepare(splash);
	JComponent glassPane = DragLayer.get();
	frame.setGlassPane(glassPane);
	glassPane.setVisible(true);
	setupWindowWideListeners(frame);
	WindowUtils.watchFontSize(frame);

	return frame;
}
 
Example 8
Source Project: netbeans   File: PleaseWait.java    License: Apache License 2.0 4 votes vote down vote up
public void uninstall() {
    setVisible(false);
    JFrame frame = (JFrame) WindowManagerImpl.getInstance().getMainWindow();
    frame.setGlassPane( oldGlass );
}
 
Example 9
Source Project: littleluck   File: FrameDemo.java    License: Apache License 2.0 4 votes vote down vote up
private static JFrame createFrame() {

        //<snip>Create frame and set simple properties
        JFrame frame = new JFrame("Demo JFrame");
        frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
        //</snip>

        //<snip>Set Minimized/titlebar icon Image
        //Note: How the image is used is platform-dependent
        Image iconImage = null;
        try {
            // todo: swingingduke.gif doesn't exist 
            URL imageURL = FrameDemo.class.getResource("resources/images/swingingduke.gif");
            iconImage = ImageIO.read(imageURL);
        } catch (Exception e) {
            // handle image IO exception
        }
        frame.setIconImage(iconImage);
        //</snip>

        //<snip>Make toplevel "busy"
        // busy glasspane is initially invisible
        frame.setGlassPane(new BusyGlass());
        //</snip>

        //<snip>Add a menubar
        JMenuBar menubar = new JMenuBar();
        frame.setJMenuBar(menubar);
        JMenu menu = new JMenu("File");
        menubar.add(menu);
        menu.add("Open");
        menu.add("Save");
        //</snip>

        //<snip>Add a horizontal toolbar
        JToolBar toolbar = new JToolBar();
        frame.add(toolbar, BorderLayout.NORTH);
        JButton btn = new JButton("Toolbar Button");
        btn.setContentAreaFilled(false);
        toolbar.add(btn);
        //</snip>

        //<snip>Add the content area
        JLabel label = new JLabel("I'm content but a little blue.");
        label.setHorizontalAlignment(JLabel.CENTER);
        label.setPreferredSize(new Dimension(300, 160));
        label.setBackground(new Color(197, 216, 236));
        label.setOpaque(true); // labels non-opaque by default
        frame.add(label);
        //snip

        //<snip>Add a statusbar
        JLabel statusLabel = new JLabel("I show status.");
        statusLabel.setBorder(new EmptyBorder(4, 4, 4, 4));
        statusLabel.setHorizontalAlignment(JLabel.LEADING);
        frame.add(statusLabel, BorderLayout.SOUTH);
        //</snip>

        //<snip>Initialize frame's size to fit it's content
        frame.pack();
        //</snip>

        return frame;
    }
 
Example 10
Source Project: wpcleaner   File: BasicWindow.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * @param parent Parent window.
 */
private void setParentComponent(JFrame parent) {
  this.parentComponent = parent;
  parent.setGlassPane(glassPane);
}