MidnightLib icon indicating copy to clipboard operation
MidnightLib copied to clipboard

Example file picker does not work

Open Daniel99j2 opened this issue 1 year ago • 2 comments

When using the file picker: @Entry(category = FILE, selectionMode = JFileChooser.FILES_ONLY, fileExtensions = {"json", "txt", "log"}, // Define valid file extensions fileChooserType = JFileChooser.SAVE_DIALOG, name = "I am a file!") public static String myFile = ""; // The isFile property adds a file picker button When pressing on the folder button, it does not open and there is an error: [09:03:08] [Thread-20/ERROR] (FabricLoader) Uncaught exception in thread "Thread-20" java.awt.HeadlessException: null at java.desktop/java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:164) ~[?:?] at java.desktop/java.awt.Window.(Window.java:553) ~[?:?] at java.desktop/java.awt.Frame.(Frame.java:428) ~[?:?] at java.desktop/java.awt.Frame.(Frame.java:393) ~[?:?] at java.desktop/javax.swing.SwingUtilities$SharedOwnerFrame.(SwingUtilities.java:1925) ~[?:?] at java.desktop/javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:2001) ~[?:?] at java.desktop/javax.swing.JOptionPane.getRootFrame(JOptionPane.java:1696) ~[?:?] at java.desktop/javax.swing.JOptionPane.getWindowForComponent(JOptionPane.java:1637) ~[?:?] at java.desktop/javax.swing.JFileChooser.createDialog(JFileChooser.java:815) ~[?:?] at java.desktop/javax.swing.JFileChooser.showDialog(JFileChooser.java:762) ~[?:?] at eu.midnightdust.lib.config.MidnightConfig$MidnightConfigScreen.lambda$fillList$11(MidnightConfig.java:366) ~[midnightlib-1.6.3-fabric.jar:?] at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]

Fabric version: 0.16.7 and 0.106.0+1.21.1 Midnight version: 1.6.3-fabric Mc version: 1.21.1 Fabric

Daniel99j2 avatar Oct 20 '24 01:10 Daniel99j2

Which operating system are you on? It seems like your Java environment doesn't support non-headless operation, which is required to create and use external windows.

Motschen avatar Sep 27 '25 14:09 Motschen

Windows 11 Surface Pro: Processor AMD Ryzen 7 Microsoft Surface (R) Edition (2.00 GHz) Installed RAM 16.0 GB (15.5 GB usable) Product ID 00330-66953-94488-AAOEM System type 64-bit operating system, x64-based processor Pen and touch Pen and touch support with 10 touch points

Running on IntelliJ Ultimate (If that matters)

Daniel99j2 avatar Sep 27 '25 23:09 Daniel99j2