Reputation: 681
I am using swing component like JFileChooser, Joption in javafx application. But when i click on JFilechooser then this is being behinds of Application. How to solve this problem. Please give me some suggestion. Thanks in advance.
Upvotes: 1
Views: 482
Reputation: 3511
You can create a subclass of JFileChooser and override the createDialog method and then return a dialog with always on top setting.
class AlwaysOnTopFileChooser extends JFileChooser {
protected JDialog createDialog(Component parent) throws HeadlessException {
JDialog dialog = super.createDialog(parent);
dialog.setAlwaysOnTop(true);
return dialog;
}
}
You will need to fill in the required constructors etc.
Upvotes: 5