33import java.awt.GridBagConstraints;
44import java.awt.GridBagLayout;
55import java.awt.Insets;
6+ import java.io.File;
67
78import javax.swing.JButton;
89import javax.swing.JFileChooser;
1314import javax.swing.JTextField;
1415
1516import com.javadeobfuscator.deobfuscator.ui.SwingWindow;
17+ import com.javadeobfuscator.deobfuscator.ui.component.SynchronousJFXFileChooser;
18+ import javafx.stage.FileChooser;
1619
1720public class FallbackException extends Exception
1821{
@@ -23,6 +26,7 @@ public FallbackException(String title, String msg, Throwable cause)
2326 super(msg, cause);
2427 this.printStackTrace();
2528 SwingWindow.ensureSwingLafLoaded();
29+ SwingWindow.initJFX();
2630 JPanel fallback = new JPanel();
2731 fallback.setLayout(new GridBagLayout());
2832 GridBagConstraints gbc = new GridBagConstraints();
@@ -46,12 +50,21 @@ public FallbackException(String title, String msg, Throwable cause)
4650 JButton button = new JButton("Select");
4751 button.addActionListener(e ->
4852 {
49- JFileChooser inputFile = new JFileChooser();
50- int action = inputFile.showOpenDialog(null);
51- if (action == JFileChooser.APPROVE_OPTION)
53+ SynchronousJFXFileChooser chooser = new SynchronousJFXFileChooser(() -> {
54+ FileChooser ch = new FileChooser();
55+ ch.setTitle("Select deobfuscator jar");
56+ ch.setInitialDirectory(new File("abc").getAbsoluteFile().getParentFile());
57+ ch.getExtensionFilters().addAll(
58+ new FileChooser.ExtensionFilter("Jar files", "*.jar"),
59+ new FileChooser.ExtensionFilter("Jar and Zip files", "*.jar", "*.zip"),
60+ new FileChooser.ExtensionFilter("Zip files", "*.zip"),
61+ new FileChooser.ExtensionFilter("All Files", "*.*"));
62+ return ch;
63+ });
64+ File file = chooser.showOpenDialog();
65+ if (file != null)
5266 {
53- String path = inputFile.getSelectedFile().toString();
54- textField.setText(path);
67+ textField.setText(file.getAbsolutePath());
5568 }
5669 });
5770 GridBagConstraints gbc_Button = new GridBagConstraints();
0 commit comments