List of usage examples for org.eclipse.swt.widgets Display Display
public Display()
From source file:ProgressBarExample.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); // Create an indeterminate ProgressBar ProgressBar pb2 = new ProgressBar(shell, SWT.HORIZONTAL | SWT.INDETERMINATE); pb2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); shell.open();/*from w w w .j a v a 2 s . c om*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
From source file:ToolItemImage.java
public static void main(String[] args) { Display display = new Display(); Image image = new Image(display, "yourFile.gif"); Shell shell = new Shell(display); ToolBar toolBar = new ToolBar(shell, SWT.FLAT | SWT.BORDER); for (int i = 0; i < 12; i++) { ToolItem item = new ToolItem(toolBar, SWT.DROP_DOWN); item.setImage(image);//from w w w . ja va 2 s . c om } toolBar.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } image.dispose(); display.dispose(); }
From source file:FontLargerCreate.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Text text = new Text(shell, SWT.MULTI | SWT.BORDER); text.setBounds(10, 10, 150, 150);// w w w . ja v a 2 s .c o m Font initialFont = text.getFont(); FontData[] fontData = initialFont.getFontData(); for (int i = 0; i < fontData.length; i++) { fontData[i].setHeight(24); } Font newFont = new Font(display, fontData); text.setFont(newFont); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } newFont.dispose(); display.dispose(); }
From source file:SashSelectionListener.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); final Sash sash = new Sash(shell, SWT.BORDER | SWT.VERTICAL); sash.setBounds(10, 10, 32, 100);// w w w . j av a 2s .com sash.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { System.out.println("selection"); sash.setBounds(e.x, e.y, e.width, e.height); } }); shell.open(); sash.setFocus(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:CreateMultipleLineText.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); // Create a multiple-line text field Text t = new Text(shell, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL); t.setLayoutData(new GridData(GridData.FILL_BOTH)); shell.open();/*from w ww. j a v a2 s . c o 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();//from w w w . j a va 2 s .c o m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:LayoutDataControlLayout.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new GridLayout()); // Only with GridLayout you can use GridData Text text = new Text(shell, SWT.SINGLE | SWT.BORDER); text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL)); shell.setSize(450, 100);/*from w ww . ja v a 2 s . c om*/ shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:TextBold.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); StyledText text = new StyledText(shell, SWT.BORDER); text.setText("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"); StyleRange style1 = new StyleRange(); style1.start = 0;//w w w. j a v a 2 s. com style1.length = 10; style1.fontStyle = SWT.BOLD; text.setStyleRange(style1); 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();//from ww w . ja va 2s.com 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);/*from w w w. j av a2 s . c o m*/ } tabFolder.pack(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }