FileDialog is an AWT component where as JFrame and JButton are Swing. Bad idea to mix those two.
Check out JFileChooser. It is a Swing substitute for FileDialog, which is centered automatically to the parent frame.
I don't want to use JFileChooser because FileDialog has a nice look(file and folder icons ) than JFileChooser and in JFileChooser all files and folders have same color. Is there any other way to set its Location.
> If you use the JFileChooser#showXXXDialog(Component parent) you need not go through the hassle of setting the location.
yes, but if you don't want the filechooser centered over the parent (and, personally, it's the best place for it),
then setLocation() should work (it used to work, but not in 1.6)
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
> I don't want to use JFileChooser because FileDialog has a nice look(file and folder icons ) than JFileChooser and in JFileChooser all files and folders have same color.
> Is there any other way to set its Location.
the problem seems to be in 1.6, so, FileDialog, being one of the older awt component classes,
you should start googling and/or search sun's bug database, or just accept (possibly modify) JFileChooser's look