Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image doesn't appear ... :(

Status
Not open for further replies.

Ju

Technical User
Jul 4, 2000
61
0
0
FR
I have a jbutton with an image as icon and when I start the applet it doesn't appear unless I roll the mouse over it...

Can you help?

Thanks
 
Have a look at the ImageObserver in the API documentation, implement the interface and repaint() the applet as soon as the image is fully loaded.

You can also just cut'n'paste the following code and then implement ImageObserver and pass "this" as the ImageObserver parameter when you construct the image:

public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height)
{
if ((infoflags | ImageObserver.ALLBITS) == ImageObserver.ALLBITS)
{
myFrame.setVisible(false);
}
return super.imageUpdate(img, infoflags, x, y, width, height);
}

Hope this helps
allow thyself to be the spark that lights the fire
haslo@haslo.ch - www.haslo.ch​
 
Oups - that was a little too much cut'n'paste I did there X-) - instead of myFrame.setVisible(false); you should of course use:

this.repaint();

Sorry about that :~/
allow thyself to be the spark that lights the fire
haslo@haslo.ch - www.haslo.ch​
 
try addind the method updateUI() at the end of your JPanel's constructor. Like:-

public class testPanel extends JPanel
{
public testPanel()
{
...
updateUI();
}
} If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 

If you still don't see the image by above given sol.ns , then may be you should add the permission for Image in policytool.There is such a permission...which is required to be added in policy file sometimes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top