请问一下,同样是JFileChooser,为什么我的是这样。。。。 JFileChooser 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 个人猜测,仅供参考。别人的是调用操作系统原生的,AWT或SWT框架,你的是Swing模拟的。 JFileChooser fileChooser = new JFileChooser( FileSystemView.getFileSystemView());让它根据当前系统来呈现 import javax.swing.filechooser.*;import javax.swing.*;public class demo2 extends JFrame { JFileChooser filechooser = new JFileChooser(FileSystemView.getFileSystemView()); public demo2() { filechooser.showOpenDialog(demo2.this); // 显示打开文件对话框 }; public static void main(String[] args) { demo2 a = new demo2(); };}还是这样,请指教。 你可以用皮肤来解决这个问题,java里面自带了一些window的皮肤,用上去之后就和系统保持一致了。 import javax.swing.filechooser.*;import javax.swing.*;public class demo2 extends JFrame { JFileChooser filechooser = new JFileChooser(FileSystemView.getFileSystemView()); public demo2() { filechooser.showOpenDialog(demo2.this); // 显示打开文件对话框 }; public static void main(String[] args) { demo2 a = new demo2(); };}还是这样,请指教。 try { UIManager.setLookAndFeel(UIManager .getSystemLookAndFeelClassName()); JFileChooser fileChooser = new JFileChooser(); fileChooser.showOpenDialog(null); } catch (Exception e) { }这样可以了,根据系统来得到UI import javax.swing.filechooser.*;import javax.swing.*;public class demo2 extends JFrame { JFileChooser filechooser = new JFileChooser(FileSystemView.getFileSystemView()); public demo2() { filechooser.showOpenDialog(demo2.this); // 显示打开文件对话框 }; public static void main(String[] args) { demo2 a = new demo2(); };}还是这样,请指教。 try { UIManager.setLookAndFeel(UIManager .getSystemLookAndFeelClassName()); JFileChooser fileChooser = new JFileChooser(); fileChooser.showOpenDialog(null); } catch (Exception e) { }这样可以了,根据系统来得到UI可以,表示非常感谢。 帮我看看这个代码那错了 java初学者编程 新手求救 JAVA不定参数探秘(想了解内部原理的都可以进来看一下) 怎样在swing中绝对定位组件 JAVA新手请教这一点点代码为什么错? Java里如何实现日期的加减操作???最好给出源码,谢谢 Applet执行完了,竟然关闭窗口?! 求websphere下载的详细地址! 请教各位Applet的数字签名怎样做1?? 关于文件解压以后对其进行删除操作的问题! 初学者问一行简单的代码解释
别人的是调用操作系统原生的,AWT或SWT框架,你的是Swing模拟的。
JFileChooser fileChooser = new JFileChooser(
FileSystemView.getFileSystemView());
让它根据当前系统来呈现
import javax.swing.filechooser.*;
import javax.swing.*;public class demo2 extends JFrame {
JFileChooser filechooser = new JFileChooser(FileSystemView.getFileSystemView()); public demo2() {
filechooser.showOpenDialog(demo2.this); // 显示打开文件对话框
}; public static void main(String[] args) {
demo2 a = new demo2();
};}还是这样,请指教。
import javax.swing.filechooser.*;
import javax.swing.*;public class demo2 extends JFrame {
JFileChooser filechooser = new JFileChooser(FileSystemView.getFileSystemView()); public demo2() {
filechooser.showOpenDialog(demo2.this); // 显示打开文件对话框
}; public static void main(String[] args) {
demo2 a = new demo2();
};}还是这样,请指教。
try {
UIManager.setLookAndFeel(UIManager
.getSystemLookAndFeelClassName());
JFileChooser fileChooser = new JFileChooser();
fileChooser.showOpenDialog(null);
} catch (Exception e) {
}
这样可以了,根据系统来得到UI
import javax.swing.filechooser.*;
import javax.swing.*;public class demo2 extends JFrame {
JFileChooser filechooser = new JFileChooser(FileSystemView.getFileSystemView()); public demo2() {
filechooser.showOpenDialog(demo2.this); // 显示打开文件对话框
}; public static void main(String[] args) {
demo2 a = new demo2();
};}还是这样,请指教。
try {
UIManager.setLookAndFeel(UIManager
.getSystemLookAndFeelClassName());
JFileChooser fileChooser = new JFileChooser();
fileChooser.showOpenDialog(null);
} catch (Exception e) {
}
这样可以了,根据系统来得到UI
可以,表示非常感谢。