Device: getDepth() : Device « org.eclipse.swt.graphics « Java by API






Device: getDepth()


/*  getBounds(): Rectangle {0, 0, 1024, 768}
    getClientArea(): Rectangle {0, 0, 1024, 740}
    getDepth(): 16
    getDPI(): Point {96, 96}
    Warnings supported: false
 * */
import org.eclipse.swt.graphics.Device;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class MainClass {
  public void run() {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Display Device");
    createContents(shell);
    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    display.dispose();
  }
  private void createContents(Shell shell) {
    Device device = shell.getDisplay();

    System.out.println("getBounds(): "+ device.getBounds());
    System.out.println("getClientArea(): "+device.getClientArea());
    System.out.println("getDepth(): "+device.getDepth());
    System.out.println("getDPI(): "+device.getDPI());

    device.setWarnings(true);
    System.out.println("Warnings supported: "+device.getWarnings());

  }

  public static void main(String[] args) {
    new MainClass().run();
  }
}

           
       








Related examples in the same category

1.Device: getBounds()
2.Device: getClientArea()
3.Device: getDPI()
4.Device: getWarnings()