KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lobobrowser > html > js > Screen


1 package org.lobobrowser.html.js;
2
3 import java.awt.*;
4
5 import org.lobobrowser.js.*;
6
7 public class Screen extends AbstractScriptableDelegate {
8     private final GraphicsEnvironment graphicsEnvironment;
9     private final GraphicsDevice graphicsDevice;
10     
11     /**
12      * @param context
13      */

14     public Screen() {
15         super();
16         this.graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
17         this.graphicsDevice = this.graphicsEnvironment.getDefaultScreenDevice();
18     }
19
20     public int getHeight() {
21         return this.graphicsDevice.getDisplayMode().getHeight();
22     }
23
24     public int getPixelDepth() {
25         return this.getColorDepth();
26     }
27
28     public int getWidth() {
29         GraphicsDevice gd = this.graphicsEnvironment.getDefaultScreenDevice();
30         return gd.getDisplayMode().getWidth();
31     }
32
33     public int getAvailHeight() {
34         return this.graphicsEnvironment.getMaximumWindowBounds().height;
35     }
36
37     public int getAvailWidth() {
38         return this.graphicsEnvironment.getMaximumWindowBounds().width;
39     }
40
41     public int getColorDepth() {
42         return this.graphicsDevice.getDisplayMode().getBitDepth();
43     }
44 }
45
Popular Tags