I have created a FileChooser in my swing application. when I click on open ,the open dialog box showing default image(java) on top of the frame instead of custom image which i was set for my JFrame.
Sample Code:
JFileChooser filec=new JFileChooser();
int fileval=filec.showOpenDialog(myjframe);
I found some times it is working fine.please help me on this.
You can set the image in the parent
JFrame
of theJFileChooser
which will be reflected in the dialog:JFrame f = new JFrame("Edit Configure File");
//Use first two ways getting error: non-static method getClass() cannot be referenced from a static context
It seems to work reliably here with this SSCCE. Does this code work reliably where you are?