468,738 Members | 2,318 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,738 developers. It's quick & easy.

how to display image on our applet using browse button

when i am clicking the browse button image not opened in my applet please help me.

// browse button, generate browse event when it clicks
if (e.getSource()==browse)
{
try{
//filedialog open for choosing directory and file name.
FileDialog fd=new FileDialog(f,"Browse..",FileDialog.LOAD);
fd.show();
MediaTracker mt = new MediaTracker(this);
Image my_gif = getImage(fd.getDirectory(),fd.getFile());
mt.addImage(my_gif,1);
mt.waitForAll();
}
catch (Exception e) {}
repaint();
}

public void paint(Graphics g)
{
super.paint( g );
g.drawImage(my_gif,600,180,300,300,p1);

}
Feb 17 '07 #1
0 1741

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Jeff Napier | last post: by
3 posts views Thread by Jordan Gomila | last post: by
3 posts views Thread by Meena Desai | last post: by
6 posts views Thread by Ben | last post: by
9 posts views Thread by shapper | last post: by
xarzu
2 posts views Thread by xarzu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.