#### Archived

This topic is now archived and is closed to further replies.

# [java] A problem with Applets

## Recommended Posts

Infin    122
I''m having a serious problem with Applets, and I''ve spent 2 days trying to solve it. I can''t find any info on this issue so I turn myself over to your expert hands. I have a class, Gamelet which extends applet. In the init() it has this code block:
if(getGraphicsConfiguration().getImageCapabilitie().isAccelerated())
{
createBufferStyle(BUFFER_STYLE_ACCELERATED);
}

It''s supposed to determine which sort of back buffer to create. But, for some reason, getGraphicsConfiguration() always returns null. The javaDoc says the getGraphicsConfiguration() should only return null if the applet isn''t being contained in a component. But I don''t understand why an applet would need to have a parent component? I want my Gamelet to be stand-alone, yet I need the graphicsConfig. information; please, if anybody can help me, give me a hint! Note: I''ve been trying to run this code in the AppletViewer of JBuilder 6, and I''m starting to suspect that that could be the reason, but I wasn''t able to set up the HTML file so that it could find the class. But one problem at a time right? Thanks in advance. -Infin.

##### Share on other sites
fractionMan    122
I''ve has similar problems creating images in applets. Try moving the code to the start() method instead

##### Share on other sites
Infin    122
Thanks alot! That did just the trick, though I''m still wondering why the error occured in the first place.

Thanks fractionMan.