swing结合swt使用,求教 swingswt图形界面FileDialog 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Display display = new Display(); Shell shell = new Shell(display); shell.setText("Main Window"); shell.setLayout(new FillLayout()); shell.setSize(500, 400); Button openButton = new Button(shell, SWT.PUSH); openButton.setLocation(2, 5); openButton.setSize(50, 20); openButton.setText("打开图片资源");openButton.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { 打开对话框: FileDialog picFileDlg = new FileDialog(shell,SWT.OPEN); picFileDlg.setFilterExtensions(new String[]{"*.jpg","*.png","*.gif"}); picFileDlg.setFilterPath("D:/pic"); picFileDlg.setText("请选择要打开的图片文件"); String filePath = picFileDlg.open(); } 我每次打开都需要new一个Shell? 我仅仅只是想用win风格的dialog而已 Windows或linux系统下获取多网卡的ip地址 如何表示JCheckBox是否被选中 关于属小母牛的问题 改了一下cow.grow();的位置,结果咋就不一样了啊 ,想不明白啊 (从网上找的一个例子) java小项目 求解析数字的正则表达式 分太少了,引不起大家注意。追加30问一个简单问题。 JAVA访问Domino Ldap用户验证问题 谁告诉我为什么这个程序运行三次啊 大家觉得MYSQL的哪个版本好用. 满分挑战:长时间的导数据过程中,触发器如何工作? 求问如何用java建win7超级用户 如果向有编程基础的java新手介绍一本入门级的教程,你会推荐哪一本?
Shell shell = new Shell(display);
shell.setText("Main Window");
shell.setLayout(new FillLayout());
shell.setSize(500, 400);
Button openButton = new Button(shell, SWT.PUSH);
openButton.setLocation(2, 5);
openButton.setSize(50, 20);
openButton.setText("打开图片资源");
openButton.addSelectionListener(new SelectionListener() { @Override
public void widgetSelected(SelectionEvent e) { 打开对话框:
FileDialog picFileDlg = new FileDialog(shell,SWT.OPEN); picFileDlg.setFilterExtensions(new String[]{"*.jpg","*.png","*.gif"});
picFileDlg.setFilterPath("D:/pic");
picFileDlg.setText("请选择要打开的图片文件");
String filePath = picFileDlg.open();
}