The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.awt  [78 examples] > The Screen  [8 examples]

e600. Getting the Number of Screens

    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    try {
        GraphicsDevice[] gs = ge.getScreenDevices();
    
        // Get number of screens
        int numScreens = gs.length;
    } catch (HeadlessException e) {
        // Is thrown if there are no screen devices
    }

 Related Examples
e598. Getting the Screen Size
e599. Centering a Frame, Window, or Dialog on the Screen
e601. Enabling Full-Screen Mode
e602. Double-Buffering in Full-Screen Mode
e603. Getting the Available Screen Sizes, Refresh Rates, and Number of Colors
e604. Getting the Current Screen Refresh Rate and Number of Colors
e605. Setting the Screen Size, Refresh Rate, or Number of Colors

See also: Colors    Components    Containers    Cursors    Drawing    Events    Focus    Frames    GridBagLayout    Images    Shapes    Simulating Events    Text   


© 2002 Addison-Wesley.