Link to home
Start Free TrialLog in
Avatar of s_lavie
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?
Avatar of muraliram
muraliram

Dear slavie,

    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
 


post your code
Avatar of s_lavie

ASKER

Dear Murali,

Your solution was great.
Post an answer and I'll post your points...

Thanks,

s_lavie
 




ASKER CERTIFIED SOLUTION
Avatar of muraliram
muraliram

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of s_lavie

ASKER

I can't accept a comment as an answer, since the question is 'unlocked'.
Thanks anyway for that answer.