English 中文(简体)
Java Windows 7 64bit - JFileChooser(未展示方言)
原标题:JavaVM Windows 7 64bit - JFileChooser() not showing dialog box

我正试图创建一种基于oleava的简单专断应用程序,要求用户从地方档案系统挑选档案。

专栏促使用户选择一种可供选择的备选办法,然后根据所提供的投入进行转换。

public Client() throws UnknownHostException, IOException {
    printuseroptions();
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    char userdecision = br.readLine().charAt(0);

    System.out.println(userdecision);

    switch(userdecision){
        case  1 :
            System.out.println("Which file would you like to open?");
            openfile(br.readLine());
            break;
        case  2 :
            System.out.println("Which file would you like to close?");
            closefile(br.readLine());
            break;
        }

private boolean openfile(String path){
    System.out.println("openfile("+path+")");
    return false;
}

private boolean closefile(String path){
    System.out.println("closefile("+path+")");
    new JFileChooser().showOpenDialog(null);
    return false;
}

不管我做什么,JFileChooser popup箱不会打开。 青 the没有发现任何错误,但解冻的步行显示出以下错误:

Blockquote Thread [main] (Suspended)
ClassNotFoundException(Throwable).(String, Throwable) line: 217
ClassNotFoundException(Exception).(String, Throwable) line: not available ClassNotFoundException.(String) line: not available
URLClassLoader$1.run() line: not available
AccessController.doPrivileged(PrivilegedExceptionAction, AccessControlContext) line: not available [native method]
Launcher$ExtClassLoader(URLClassLoader).findClass(String) line: not available
Launcher$ExtClassLoader.findClass(String) line: not available
Launcher$ExtClassLoader(ClassLoader).loadClass(String, boolean) line: not available Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: not available Launcher$AppClassLoader.loadClass(String, boolean) line: not available
Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not available
ResourceBundle$RBClassLoader.loadClass(String) line: not available
CoreResourceBundleControl(ResourceBundle$Control).newBundle(String, Locale, String, ClassLoader, boolean) line: not available
ResourceBundle.loadBundle(CacheKey, List, Control, boolean) line: not available ResourceBundle.findBundle(CacheKey, List, List, int, Control, ResourceBundle) line: not available
ResourceBundle.getBundleImpl(String, Locale, ClassLoader, ResourceBundle$Control) line: not available
ResourceBundle.getBundle(String, ResourceBundle$Control) line: not available
Toolkit$3.run() line: not available AccessController.doPrivileged(PrivilegedAction) line: not available [native method]
Toolkit.() line: not available
Component.() line: not available
Client.closefile() line: 90 Client.() line: 60
Client.main(String[]) line: 36

同一代码完全使用第32轨机器,因此我怀疑这个问题与Windows有关。

下面的代码在Windows和HCH上都按预期操作,因此,我怀疑可能是因为在Windows vsosphere(CR LF)处理青 input素投入时有不同的方式。

import javax.swing.JFileChooser;

public class Example {
    public static void main(String[] args) {
        new JFileChooser().showOpenDialog(null);
    }
}

增 编

最佳回答

我在这里想像我一样,再回来。 让我看一下我是否能够提供帮助。

我对你的代码作了修改,以使之汇编成册,并将其存放在Windows 2003 x64的机器上,并且没有看到任何问题——档案选择方的方言。

我建议你可以做两件事,以消除其他可能性:

1) Ensure the system s native look & feel is set. Set your look & feel to the system default by using this when your program starts: UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

2) 确保你在活动现场(EDT)仅建造和开放和所有其他互换部件。 如果你知道目前的胎面是主要的胎面或其他一些工人的胎面(我假定是,由于你重新吸收了青 input素,你需要打<条码>,以便正确执行。

很幸运。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签