Java by API/org.eclipse.swt.graphics/Device

Материал из Java эксперт
Перейти к: навигация, поиск

Device: getBounds()

   <source lang="java">

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

}

      </source>
   
  
 
  



Device: getClientArea()

   <source lang="java">

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

}

      </source>
   
  
 
  



Device: getDepth()

   <source lang="java">

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

}

      </source>
   
  
 
  



Device: getDPI()

   <source lang="java">

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

}

      </source>
   
  
 
  



Device: getWarnings()

   <source lang="java">

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

}

      </source>