📄 groupexample.java
字号:
/**@author WangJinTao,MengQingChang 2006
*/
package basic.widget;
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
public class GroupExample {
public GroupExample() {
final Display display = Display.getDefault();
final Shell shell = new Shell();
shell.setSize(240, 300);
shell.setText("Group实例");
shell.setToolTipText("Shell容器");
final Group group1 = new Group(shell, SWT.NONE);
group1.setBounds(40, 25, 160, 60);
group1.setText("请选择:");
group1.setToolTipText("Group容器");
Button button1 = new Button(group1, SWT.RADIO);
button1.setBounds(20, 10, 100, 25);
button1.setText("Group实例");
Button button2 = new Button(group1, SWT.RADIO);
button2.setBounds(20, 35, 100, 25);
button2.setText("Button实例");
final Group group2 = new Group(shell, SWT.NONE);
group2.setBounds(40, 110, 160, 90);
group2.setToolTipText("Group容器");
Button button3 = new Button(group2, SWT.CHECK);
button3.setBounds(20, 10, 100, 25);
button3.setText("Label实例");
Button button4 = new Button(group2, SWT.CHECK);
button4.setBounds(20, 35, 100, 25);
button4.setText("Combo实例");
Button button5 = new Button(group2, SWT.CHECK);
button5.setBounds(20, 60, 100, 25);
button5.setText("List实例");
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
public static void main(String[] args) {
new GroupExample();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -