List of usage examples for org.eclipse.swt.widgets Button Button
public Button(Composite parent, int style)
From source file:GetPreferredSize.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); Button button = new Button(shell, SWT.PUSH | SWT.LEFT); button.setText("Button"); System.out.println("toControl: " + button.toControl(100, 200)); shell.open();//from www .j a v a2 s . co m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
From source file:ControlSizeLocation.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Button button = new Button(shell, SWT.PUSH); shell.setSize(260, 120);/*w ww.j a va2s . c om*/ shell.open(); System.out.println("------------------------------"); System.out.println("getBounds: " + button.getBounds()); System.out.println("getLocation: " + button.getLocation()); System.out.println("getSize: " + button.getSize()); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
From source file:NoLayoutSimple.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Button button = new Button(shell, SWT.PUSH); button.setText("No layout"); button.setBounds(new Rectangle(5, 5, 100, 100)); shell.pack();//from w w w . j ava 2 s.co m shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:DisplayPositionRelative.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); Button button = new Button(shell, SWT.PUSH | SWT.LEFT); button.setText("Button"); System.out.println("toDisplay: " + button.toDisplay(100, 200)); shell.open();//from www. j a v a2s .com while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
From source file:FormLayoutFormDataAttachment.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FormLayout()); Button button1 = new Button(shell, SWT.PUSH); button1.setText("button1"); shell.setSize(450, 400);/*from www . j a v a2 s . co m*/ shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:WidgetSizeCompute.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); Button button = new Button(shell, SWT.PUSH | SWT.LEFT); button.setText("Button"); System.out.println("Bounds: " + button.getBounds()); System.out.println("computeSize: " + button.computeSize(100, SWT.DEFAULT)); System.out.println("computeSize: " + button.computeSize(40, SWT.DEFAULT)); System.out.println("computeSize: " + button.computeSize(SWT.DEFAULT, 100)); System.out.println("computeSize: " + button.computeSize(SWT.DEFAULT, 20)); System.out.println("computeSize: " + button.computeSize(SWT.DEFAULT, 15)); System.out.println("computeSize: " + button.computeSize(100, 200)); System.out.println("computeSize: " + button.computeSize(SWT.DEFAULT, SWT.DEFAULT)); shell.open();/*from ww w . j a v a2 s .co m*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
From source file:ButtonBasics.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new RowLayout()); Button button = new Button(shell, SWT.RIGHT); button.setText("text on the button"); shell.open();/*from w w w . j ava 2 s .com*/ // Set up the event loop. while (!shell.isDisposed()) { if (!display.readAndDispatch()) { // If no more entries in event queue display.sleep(); } } display.dispose(); }
From source file:ButtonAlignment.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new FillLayout()); Button button = new Button(shell, SWT.RIGHT); button.setText("text on the button"); button.setAlignment(SWT.CENTER);//w w w . j a v a2 s . c o m shell.open(); // Set up the event loop. while (!shell.isDisposed()) { if (!display.readAndDispatch()) { // If no more entries in event queue display.sleep(); } } display.dispose(); }
From source file:ShellStyleTrimTool.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display, SWT.SHELL_TRIM | SWT.TOOL); shell.setLayout(new GridLayout()); Button button = new Button(shell, SWT.PUSH | SWT.LEFT); button.setText("Button"); shell.open();/*from w ww. j av a 2 s . c om*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
From source file:ButtonTextAlignment.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new FillLayout()); Button button = new Button(shell, SWT.RIGHT); button.setText("text on the button"); shell.open();//from w w w. ja va2 s.co m // Set up the event loop. while (!shell.isDisposed()) { if (!display.readAndDispatch()) { // If no more entries in event queue display.sleep(); } } display.dispose(); }