Mega Code Archive

 
Categories / Java by API / Org Eclipse Swt Graphics
 

Device

/*  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();   } }