Swing full screen





7
Date Submitted Wed. Sep. 5th, 2007 9:21 PM
Revision 1 of 1
Helper rugi
Tags "full | desktop | Java | screen" | Swing
Comments 0 comments
Snippet for display one frame in full screen mode.

    public static void main(String[] args) throws Exception {
        System.out.println("Probando Full Screen...");
        JFrame fr = new JFrame();
        fr.setTitle("Test Title");
        fr.getContentPane().add(new JLabel("Test content"));
        fr.setResizable(false);
        if (!fr.isDisplayable()){
            fr.setUndecorated(true);           
        }
        GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
        gd.setFullScreenWindow(fr);
        fr.setVisible(true);
        Thread.sleep(5000);
        System.exit(0);
    }
 

Isaac Ruiz Guerra

weblogs.javahispano.org/rugi/
"non nobis domine"

Comments

There are currently no comments for this snippet.

Voting