📄 application1.java
字号:
package applications;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
/**
* @author scheglov_ke
*/
public class Application1 {
private void test() {
}
public static void foo() {
System.out.println("foo");
}
public static void bar() {
Shell shell = new Shell();
}
public static void main(String[] args) {
Display display = new Display();
final Shell shell = new Shell();
shell.setLayout(new FillLayout());
shell.setText("Hello, World!3");
//
Label label = new Label(shell, SWT.CENTER);
label.setText("Hello, Label!");
//
{
Group group_1 = new Group(shell, SWT.NONE);
RowLayout layout = new RowLayout();
group_1.setLayout(layout);
group_1.setText("group 1");
Button btn = new Button(group_1, SWT.CHECK);
btn.setText("Button2");
}
//
{
Group group_1 = new Group(shell, SWT.NONE);
RowLayout rowLayout = new RowLayout();
rowLayout.spacing = 10;
group_1.setLayout(rowLayout);
group_1.setText("group 2");
//
Button btn = new Button(group_1, SWT.BORDER | SWT.PUSH);
btn.setText("Another button3");
//
Button btn2 = new Button(group_1, SWT.NONE);
btn2.setText("Test");
Composite composite = new Composite(group_1, SWT.BORDER);
RowLayout rowLayout_1 = new RowLayout();
rowLayout_1.spacing = 23;
rowLayout_1.marginTop = 6;
composite.setLayout(rowLayout_1);
Text text = new Text(group_1, SWT.BORDER | SWT.CENTER | SWT.MULTI);
text.setText("123");
Button button = new Button(composite, SWT.CHECK | SWT.FLAT);
button.setText("btn");
Label label_1 = new Label(composite, SWT.NONE);
label_1.setText("Select car:");
}
//shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -