Archived

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

CPops57

[java] Using drawRect() inside a GUI application?

Recommended Posts

Never tried it myself, but maybe make an Image object and add it to the content pane?

JFrame frame = new JFrame();
Container content = frame.getContentPane();

Image img = new Image(various constructors);
Graphics gBuffer = img.getGraphics();
content.add(img);

I don''t know if you can add an Image object to the content pane though, cause an Image really isn''t a swing component. Ah well, I''m too tired to dig through the API documentation right now.

Share this post


Link to post
Share on other sites