List of usage examples for org.eclipse.swt.widgets Display Display
public Display()
From source file:MainClass.java
public static void main(String[] a) { Display d = new Display(); Shell s = new Shell(d); s.setSize(250, 250);/* ww w.ja v a 2s . c o m*/ s.setText("A GridLayout Example"); GridLayout gl = new GridLayout(); gl.numColumns = 3; s.setLayout(gl); Label l1 = new Label(s, SWT.BORDER); l1.setText("Column One"); final Label l2 = new Label(s, SWT.BORDER); l2.setText("Column Two"); final Label l3 = new Label(s, SWT.BORDER); l3.setText("Column Three"); Text t1 = new Text(s, SWT.SINGLE | SWT.BORDER); Text t2 = new Text(s, SWT.SINGLE | SWT.BORDER); Text t3 = new Text(s, SWT.SINGLE | SWT.BORDER); Text t4 = new Text(s, SWT.SINGLE | SWT.BORDER); Text t5 = new Text(s, SWT.SINGLE | SWT.BORDER); Text t6 = new Text(s, SWT.SINGLE | SWT.BORDER); s.open(); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:CLabelCenterShadowOut.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("CLabel Test"); shell.setLayout(new GridLayout(1, false)); CLabel center = new CLabel(shell, SWT.CENTER | SWT.SHADOW_OUT); center.setText("Center and Shadow Out"); center.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); shell.open();// w w w. j ava 2s . co m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:ComboSelectedIndex.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Show Message Box"); shell.setLayout(new GridLayout(2, false)); new Label(shell, SWT.NONE).setText("Icon:"); final Combo icons = new Combo(shell, SWT.DROP_DOWN | SWT.READ_ONLY); icons.add("A"); icons.add("B"); icons.add("C"); icons.select(0);//from w w w . j av a 2 s. c o m new Label(shell, SWT.NONE).setText("Buttons:"); final Combo buttons = new Combo(shell, SWT.DROP_DOWN | SWT.READ_ONLY); buttons.add("1"); buttons.add("2"); buttons.select(0); new Label(shell, SWT.NONE).setText("Return:"); final Label returnVal = new Label(shell, SWT.NONE); returnVal.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Button button = new Button(shell, SWT.PUSH); button.setText("Show Message"); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { returnVal.setText(""); returnVal.setText(icons.getSelectionIndex() + " " + buttons.getSelectionIndex()); } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:SashFormVertical.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("SashForm Test"); // Fill the parent window with the buttons and sash shell.setLayout(new FillLayout()); // Create the SashForm and the buttons SashForm sashForm = new SashForm(shell, SWT.VERTICAL); new Button(sashForm, SWT.PUSH).setText("Left"); new Button(sashForm, SWT.PUSH).setText("Right"); shell.open();/*from w ww.j a va 2 s . c o m*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:CLabelRightShadowNone.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("CLabel Test"); shell.setLayout(new GridLayout(1, false)); CLabel right = new CLabel(shell, SWT.RIGHT | SWT.SHADOW_NONE); right.setText("Right and Shadow None"); right.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); shell.open();// w w w . ja v a 2s . c o m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:MainClass.java
public static void main(String[] a) { final Display d = new Display(); final Shell s = new Shell(d); s.setSize(250, 200);// w w w .j a v a 2 s.c o m s.setText("A Table Shell Example"); s.setLayout(new FillLayout()); Tree t = new Tree(s, SWT.SINGLE | SWT.BORDER); TreeItem child1 = new TreeItem(t, SWT.NONE, 0); child1.setText("1"); TreeItem child2 = new TreeItem(t, SWT.NONE, 1); child2.setText("2"); TreeItem child2a = new TreeItem(child2, SWT.NONE, 0); child2a.setText("2A"); TreeItem child2b = new TreeItem(child2, SWT.NONE, 1); child2b.setText("2B"); TreeItem child3 = new TreeItem(t, SWT.NONE, 2); child3.setText("3"); s.open(); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:MouseListenerUsing.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new RowLayout()); shell.addMouseListener(new MouseListener() { public void mouseDoubleClick(MouseEvent arg0) { System.out.println("mouseDoubleClick"); }// ww w . j ava 2 s. c o m public void mouseDown(MouseEvent arg0) { System.out.println("mouseDown"); } public void mouseUp(MouseEvent arg0) { System.out.println("mouseUp"); } }); // Display the window shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:ControlSizeSetting.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setSize(150, 150);/*from w w w. j a v a 2s .c o m*/ final Cursor[] cursor = new Cursor[1]; Button button = new Button(shell, SWT.PUSH); button.setText("Change cursor"); Point size = button.computeSize(SWT.DEFAULT, SWT.DEFAULT); button.setSize(size); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } if (cursor[0] != null) cursor[0].dispose(); display.dispose(); }
From source file:ButtonImageAdd.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Image image = new Image(display, "yourFile.gif"); Button button = new Button(shell, SWT.PUSH); button.setImage(image);//from w w w.j a v a 2 s .c om button.setText("button"); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
From source file:MainClass.java
public static void main(String[] a) { Display display = new Display(); // Create the main window Shell shell = new Shell(display); Text fahrenheit = new Text(shell, SWT.BORDER); fahrenheit.setData("Type a temperature in Fahrenheit"); fahrenheit.setBounds(20, 20, 100, 20); fahrenheit.addHelpListener(new HelpListener() { public void helpRequested(HelpEvent event) { System.out.println((String) event.widget.getData()); }/*from w w w .ja v a2 s. c o m*/ }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }