Slider
Slider slider1 = new Slider(shell, SWT.HORIZONTAL);
slider1.setBounds(0,0,200,20);
slider1.setSelection(50);
slider1.setMaximum(100);
slider1.setMinimum(0);
slider1.setThumb(30);
Scale
Scale scale1 = new Scale(shell, SWT.HORIZONTAL);
scale1.setBounds(0,40,200,40);
scale1.setMinimum(0);
scale1.setMaximum(500);
scale1.setSelection(100);
scale1.setPageIncrement(50);
Progress Bar
ProgressBar progressBar1 = new ProgressBar(shell,SWT.HORIZONTAL);
progressBar1.setMinimum(0);
progressBar1.setMaximum(100);
progressBar1.setSelection(30);
progressBar1.setBounds(0,100,250,20);
Combo
Combo combo1 = new Combo(shell, SWT.DROP_DOWN|SWT.READ_ONLY);
combo1.setItems(new String[] {"One","Two","Three"});
combo1.select(0);
combo1.setLocation(0,0);
combo1.setSize(100,20);
Combo combo2 = new Combo(shell, SWT.SIMPLE);
combo2.setItems(new String[] {"Four","Five","Six",});
combo2.setBounds(50,50,200,150);
combo2.select(1);
Menu
Menu menu = new Menu(shell, SWT.BAR);
shell.setMenuBar(menu);
MenuItem file = new MenuItem(menu, SWT.CASCADE);
file.setText("File");
Menu filemenu = new Menu(shell, SWT.DROP_DOWN);
file.setMenu(filemenu);
MenuItem actionItem = new MenuItem(filemenu, SWT.PUSH);
actionItem.setText("Action");
actionItem.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
System.out.println("Action performed!");
}
});
ToolBar
final ToolBar bar = new ToolBar(shell,SWT.HORIZONTAL);
bar.setSize(380,150);
bar.setLocation(10,10);
Image icon = new Image(display, "grayblock_v.gif"); // catch FileNotFoundException
ToolItem pushItem = new ToolItem(bar, SWT.PUSH);
pushItem.setText("Push");
pushItem.setImage(icon);
CoolBar
final CoolBar bar = new CoolBar(shell, SWT.BORDER);
CoolItem item1 = new CoolItem(bar, SWT.NONE);
Button button1 = new Button(bar, SWT.FLAT | SWT.BORDER);
button1.setText("Button");
button1.pack();
Point size = button1.getSize();
item1.setControl(button1);
item1.setSize(item1.computeSize(size.x, size.y));
bar.setWrapIndices(new int[] {3});
bar.setSize(300, 120);
No comments:
Post a Comment