このランタイムエラーが発生しました.Javaファイルの選択をウィンドウのようにしています。WindowsFileChooserUIを使用しているときにNullPointerExceptionが発生する
エラーコード:
Exception in thread "main" java.lang.NullPointerException
at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponents(WindowsFileChooserUI.java:306)
at javax.swing.plaf.basic.BasicFileChooserUI.installUI(BasicFileChooserUI.java:173)
at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(WindowsFileChooserUI.java:150)
at Main.getImg(Main.java:49)
at Main.main(Main.java:19)
コード:
JFileChooser fico = new JFileChooser();
WindowsFileChooserUI wui = new WindowsFileChooserUI(fico);
wui.installUI(fico);
int returnVal = fico.showOpenDialog(null);
私はあなたの質問に4行のコードを実行しましたが、例外はありません。あなたの質問を指定するか、より多くのコードを送ることができますか? – Juvanis