List of usage examples for org.eclipse.swt.widgets Display Display
public Display()
From source file:TextSelectionListener.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new RowLayout()); Text text = new Text(shell, SWT.SINGLE | SWT.BORDER); text.setText("some text"); text.addListener(SWT.DefaultSelection, new Listener() { public void handleEvent(Event e) { System.out.println(e.widget + " - Default Selection"); }//from ww w . ja va2s . co m }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:DrawTextSWT.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Canvas Example"); shell.setLayout(new FillLayout()); Canvas canvas = new Canvas(shell, SWT.NONE); canvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { e.gc.drawString("www.java2s.com", 5, 5); }//from ww w. ja v a2 s. c o m }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:StyledTextVerifyListenerEventInforation.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); StyledText styledText = new StyledText(shell, SWT.V_SCROLL | SWT.BORDER); styledText.setText("12345"); styledText.addVerifyListener(new VerifyListener() { public void verifyText(VerifyEvent event) { System.out.println(event.start); System.out.println(event.end); System.out.println(event.text); }/* w ww. j ava 2s . c om*/ }); styledText.setBounds(10, 10, 100, 100); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:HelpListenerUsing.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new RowLayout()); Text text = new Text(shell, SWT.SINGLE | SWT.BORDER); text.setText("press F1 function to see the help message."); text.addHelpListener(new HelpListener() { public void helpRequested(HelpEvent arg0) { System.out.println("Help wanted"); }//from ww w . j a v a 2 s . c o m }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:DrawOval.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Canvas Example"); shell.setLayout(new FillLayout()); Canvas canvas = new Canvas(shell, SWT.NONE); canvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { e.gc.drawOval(200, 100, 500, 400); }//from w w w.ja va 2s. co m }); canvas.redraw(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:ImageCreateCode.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Label label = new Label(shell, SWT.NONE); label.setImage(getCheckedImage(display)); shell.open();//w w w.ja va2 s .c o m while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:DrawArcSWT.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Canvas Example"); shell.setLayout(new FillLayout()); Canvas canvas = new Canvas(shell, SWT.NONE); canvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { e.gc.setBackground(e.display.getSystemColor(SWT.COLOR_BLACK)); e.gc.fillArc(200, 100, 500, 400, 30, 40); }/*from w w w .ja va 2 s . c o m*/ }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:TreeNodeCheckBoxAdd.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Tree tree = new Tree(shell, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); for (int i = 0; i < 12; i++) { TreeItem item = new TreeItem(tree, SWT.NONE); item.setText("Item " + i); for (int l = 0; l < 12; l++) { TreeItem litem = new TreeItem(item, SWT.NONE); litem.setText("Item " + i); }/* ww w . ja v a 2 s.co m*/ } tree.setSize(100, 100); shell.setSize(200, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:StyledTextPaint.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setBounds(10, 10, 250, 250);// w ww . j av a 2 s . c o m final StyledText text = new StyledText(shell, SWT.NONE); text.setBounds(10, 10, 200, 200); text.addListener(SWT.Paint, new Listener() { public void handleEvent(Event event) { System.out.println("paint"); } }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:Snippet30.java
public static void main(String[] args) { Display display = new Display(); Program p = Program.findProgram(".txt"); if (p != null) p.execute("c:\\autoexec.bat"); display.dispose();/* w ww. j a v a 2 s . co m*/ }