初始界面不显示

gousheng12345 gousheng12345 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
请问我的程序(使用SWT,平台是Eclipse)为什么在初次运行的时候没有显示出想要的带有单选框和复选框界面,而只是一个空白面板呢?另外我还想问下如何设置Shell的属性使其大小不可更改呢(如最大化最小化按钮失效,Shell大小不可变)?望高手指教,以下是程序源代码

package DemoComposite;

import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.layout.FillLayout;

public class DemoComposite2
{
private Display display =null;
private Shell shell = null; // @jve:decl-index=0:visual-constraint="10,10"
private Composite composite1 = null;
private Composite composite2 = null;
private Button radioButton1 = null;
private Button radioButton2 = null;
private Button checkBox1 = null;
private Button checkBox2 = null;

/**
* This method initializes shell
*/
public DemoComposite2(){
createShell();
shell.open();
while (!shell.isDisposed()){
if(display.readAndDispatch())
display.sleep();

}
shell.dispose();
}
private void createShell()
{
display =new Display();
shell = new Shell(display);
shell.setText("容器演示");
createComposite1();
createComposite2();
shell.setSize(new Point(371, 211));
shell.setLayout(new FillLayout());
}

/**
* This method initializes composite1
*
*/
private void createComposite1()
{
composite1 = new Composite(shell, SWT.NONE);
composite1.setLayout(new GridLayout());
composite1.setBackground(new Color(Display.getCurrent(), 236, 150, 216));
radioButton1 = new Button(composite1, SWT.RADIO);
radioButton1.setText("liu li");
radioButton2 = new Button(composite1, SWT.RADIO);
radioButton2.setText("Zhang li");
}

/**
* This method initializes composite2
*
*/
private void createComposite2()
{
composite2 = new Composite(shell, SWT.NONE);
composite2.setLayout(new RowLayout(SWT.VERTICAL));
composite2.setBackground(new Color(Display.getCurrent(), 255, 255, 255));
checkBox2 = new Button(composite2, SWT.CHECK);
checkBox2.setText("Zhang li");
checkBox1 = new Button(composite2, SWT.CHECK);
checkBox1.setText("Liu li");
}
public static void main(String[] args)
{
new DemoComposite2();

}

}
...全文

相关推荐

初始界面UI

初始界面包括,游戏LOGO,Press Any Key To Start 按键,New Game 和 Load Game 按钮; 首先右键NGUI选择Create/Sprite  选择logo 图片 然后选择合适位置放置,给LOGO添加Tween/Alpha  将LOGO的颜色调制透明,然后From0 To 1  延时和渐显时间自己设置。 然后右键NGUI选择Create/Sprite  选择

马大哈哈哈

SketchUp教程(001):界面初始与软件重要设置

本文介绍了SketchUp软件界面初始设置与优化方法。主要内容包括:1)初始界面布局调整与坐标轴介绍;2)基础设置操作,如导入模型、切换样式、保存模板等;3)系统设置中的图形、常规和工作区选项配置;4)模型信息中的尺寸单位设置,建议取消显示单位格式(默认mm)。文章配有详细操作截图,并提供了免费3D模型下载地址,适合初学者快速掌握SketchUp基础设置技巧。

文理棵

科技中介服务机构如何提升技术评估的智能化与专业化水平?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

BIZKEEN

高校技术转移办公室人员在开展技术推介时,如何高效生成科技成果展示材料?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

BIZKEEN

产业园区运营负责人如何实现创新资源的高效整合与精准配置?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

BIZKEEN
评论 7
收藏 已收藏
分享
返回顶部
gousheng12345
Java SE 62,621 成员 307,251 内容