List of usage examples for org.eclipse.swt.widgets Button Button
public Button(Composite parent, int style)
From source file:FormLayoutFormData.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); FormLayout layout = new FormLayout(); layout.marginHeight = 5;// ww w .ja v a 2 s. com layout.marginWidth = 10; shell.setLayout(layout); Button button = new Button(shell, SWT.PUSH); button.setText("Button"); FormData data = new FormData(); data.height = 50; data.width = 50; button.setLayoutData(data); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:GridLayoutMakeColumnWidth.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2;//from ww w .jav a2s .co m gridLayout.makeColumnsEqualWidth = true; shell.setLayout(gridLayout); Button button1 = new Button(shell, SWT.PUSH); button1.setText("button1"); List list = new List(shell, SWT.BORDER); list.add("item 1"); list.add("item 2"); list.add("item 3"); Button button2 = new Button(shell, SWT.PUSH); button2.setText("button #2"); Button button3 = new Button(shell, SWT.PUSH); button3.setText("button #3"); shell.setSize(450, 400); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:FormLayoutFormAttachmentSetButton.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); FormLayout layout = new FormLayout(); layout.marginHeight = 5;//from w w w.j a va2s. c o m layout.marginWidth = 10; shell.setLayout(layout); Button one = new Button(shell, SWT.PUSH); one.setText("One"); FormData data = new FormData(); data.top = new FormAttachment(0, 5); data.left = new FormAttachment(0, 5); data.bottom = new FormAttachment(50, -5); data.right = new FormAttachment(50, -5); one.setLayoutData(data); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:TabFolderTabItem.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); final TabFolder tabFolder = new TabFolder(shell, SWT.BORDER); for (int i = 0; i < 6; i++) { TabItem item = new TabItem(tabFolder, SWT.NONE); item.setText("TabItem " + i); Button button = new Button(tabFolder, SWT.PUSH); button.setText("Page " + i); item.setControl(button);// w w w.ja va 2 s .c o m } tabFolder.pack(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:TabItemSelection.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); final TabFolder tabFolder = new TabFolder(shell, SWT.BORDER); for (int i = 0; i < 6; i++) { TabItem item = new TabItem(tabFolder, SWT.NONE); item.setText("TabItem " + i); Button button = new Button(tabFolder, SWT.PUSH); button.setText("Page " + i); item.setControl(button);//from www. j a va 2 s . c o m } tabFolder.setSelection(2); tabFolder.pack(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:RowLayoutTest.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); RowLayout layout = new RowLayout(SWT.VERTICAL); layout.marginLeft = 12;/*from w w w . ja v a2 s . com*/ layout.marginTop = 0; layout.justify = true; shell.setLayout(layout); new Button(shell, SWT.PUSH).setText("one"); new Button(shell, SWT.PUSH).setText("two"); new Button(shell, SWT.PUSH).setText("three"); new Button(shell, SWT.PUSH).setText("four"); new Button(shell, SWT.PUSH).setText("five"); new Button(shell, SWT.PUSH).setText("six"); Button b = new Button(shell, SWT.PUSH); b.setText("seven"); b.setLayoutData(new RowData(100, 100)); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:MainClass.java
public static void main(String[] a) { Display display = new Display(); Shell shell = new Shell(display); GridLayout layout = new GridLayout(); layout.numColumns = 2;//from www .ja v a 2 s. c o m layout.makeColumnsEqualWidth = true; shell.setLayout(layout); GridData data = new GridData(GridData.FILL_BOTH); Button one = new Button(shell, SWT.PUSH); one.setText("one"); one.setLayoutData(data); data = new GridData(GridData.FILL_BOTH); Button two = new Button(shell, SWT.PUSH); two.setText("two"); two.setLayoutData(data); data = new GridData(GridData.FILL_BOTH); Button three = new Button(shell, SWT.PUSH); three.setText("three"); three.setLayoutData(data); data = new GridData(GridData.FILL_BOTH); Button four = new Button(shell, SWT.PUSH); four.setText("four"); four.setLayoutData(data); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:SashFormOri.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"); sashForm.setOrientation(SWT.HORIZONTAL); shell.open();/* w w w.j a v a2 s . c o m*/ 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 www. j av a2s . co m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:SashFormCreate.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.HORIZONTAL); new Button(sashForm, SWT.PUSH).setText("Left"); new Button(sashForm, SWT.PUSH).setText("Right"); shell.open();/* ww w .j a va 2 s. com*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }