How to open files in Java Swing without JFileChooser -
i'm using java swing (gui) , want add button project opening files.
i don't jfilechooser since opens small window browsing through files of directories. can use else instead of jfilechooser under java swing?
i've tried use elements of swt didn't work, meaning use of button object , use inside jframe, failed, guess swt , swing don't mix together?
here example of java swing jfilechooser , i'm looking like this put in jframe.

jfilechooser native plaf seems fulfill stated requirement.

import javax.swing.jfilechooser; import javax.swing.swingutilities; import javax.swing.uimanager; public class nativefilechooser { public static void main(string[] args) { swingutilities.invokelater(new runnable() { @override public void run() { try { uimanager.setlookandfeel( uimanager.getsystemlookandfeelclassname()); } catch(exception e) { e.printstacktrace(); } jfilechooser jfc = new jfilechooser(); jfc.showopendialog(null); } }); } } still not quite liking? might start this one & change need:

..so guess swt , swing don't mix together?
it not idea mix swing/awt/swt components in same top-level container. not problem open awt filedialog on swing based jframe since both top-level containers. pretty sure same apply swing/swt or awt/swt.
Comments
Post a Comment