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而已 新手学java 一点小问题 关于jtextpane中输入文字的问题 关于页面跳转的问题!!! java 如何从txt文档中读取内容到string[]数组中 如何在JTextArea中实现撤消功能 还是关于阴阳历互转的问题,50分 Exception的问题 java swing scroll 滚动条不显示 看不清方向的java学员,望赐教|~~~ jdk和jvm 求问如何用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();
}