Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
幼稚园小盆友
代码片段(2)
提交
7d7967f3
代
代码片段(2)
项目概览
幼稚园小盆友
/
代码片段(2)
与 Fork 源项目一致
Fork自
inscode / Java
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
代
代码片段(2)
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7d7967f3
编写于
2月 18, 2024
作者:
幼稚园小盆友
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
生产代码片段
上级
00470cde
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
45 addition
and
4 deletion
+45
-4
Main.java
Main.java
+45
-4
未找到文件。
Main.java
浏览文件 @
7d7967f3
class
Main
{
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.layout.FillLayout
;
import
org.eclipse.swt.widgets.*
;
public
class
SWTWindowExample
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"Hello world!"
);
Display
display
=
new
Display
();
Shell
shell
=
new
Shell
(
display
);
shell
.
setText
(
"SWT Window Example"
);
shell
.
setSize
(
400
,
300
);
// 创建Composite容器
Composite
composite
=
new
Composite
(
shell
,
SWT
.
NONE
);
composite
.
setLayout
(
new
FillLayout
(
SWT
.
VERTICAL
));
// 创建左侧部分,显示BMIDE的lov值
Table
table
=
new
Table
(
composite
,
SWT
.
BORDER
|
SWT
.
V_SCROLL
);
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
TableItem
item
=
new
TableItem
(
table
,
SWT
.
NONE
);
item
.
setText
(
"Item "
+
i
);
}
// 创建右侧部分,带单选按钮
Group
group
=
new
Group
(
composite
,
SWT
.
NONE
);
group
.
setText
(
"Options"
);
group
.
setLayout
(
new
FillLayout
(
SWT
.
VERTICAL
));
Button
button1
=
new
Button
(
group
,
SWT
.
RADIO
);
button1
.
setText
(
"Option 1"
);
Button
button2
=
new
Button
(
group
,
SWT
.
RADIO
);
button2
.
setText
(
"Option 2"
);
// 设置滚动条
ScrolledComposite
scrolledComposite
=
new
ScrolledComposite
(
shell
,
SWT
.
V_SCROLL
);
scrolledComposite
.
setContent
(
composite
);
scrolledComposite
.
setExpandVertical
(
true
);
scrolledComposite
.
setExpandHorizontal
(
true
);
shell
.
open
();
while
(!
shell
.
isDisposed
())
{
if
(!
display
.
readAndDispatch
())
{
display
.
sleep
();
}
}
display
.
dispose
();
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录