s_lavie
asked on
JApplet + image
Hi,
I'm trying to implement an applet that loads a frame with an imaged button.
My applet has its button on the html page, and when clicking on it the frame has to appear.
It works fine with out the image, but when I add the line:
ImageIcon img = new ImageIcon(new URL("file:" + imgFullPath));
the frame dosen't appear.
I'm using JApplet as the applet, JFrame as the frame, and JButton as the button.
What is wrong?
I'm trying to implement an applet that loads a frame with an imaged button.
My applet has its button on the html page, and when clicking on it the frame has to appear.
It works fine with out the image, but when I add the line:
ImageIcon img = new ImageIcon(new URL("file:" + imgFullPath));
the frame dosen't appear.
I'm using JApplet as the applet, JFrame as the frame, and JButton as the button.
What is wrong?
post your code
ASKER
Dear Murali,
Your solution was great.
Post an answer and I'll post your points...
Thanks,
s_lavie
Your solution was great.
Post an answer and I'll post your points...
Thanks,
s_lavie
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I can't accept a comment as an answer, since the question is 'unlocked'.
Thanks anyway for that answer.
Thanks anyway for that answer.
Do one thing
ImageIcon img = new ImageIcon(new URL(getCodeBase() +"imagename.jpg"));
Put the image in the same directory as that of the class file and try.
This may solve the problem
Bye
Murali