Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm using the Swing UI toolkit in Java, and I want to use the Graphics class to draw images and grids in a control. Which is the most appropriate control for this?

share|improve this question
add comment

1 Answer

A cursory bit of searching with Google suggests that you probably want to use JPanel for this, although it's possible you could make use of any control since it looks like the technique you'll want to use is to subclass the control and override a method (the paintComponent method, specifically), which will give you a Graphics instance you can use for rendering.

JPanel appears to be a very basic empty control and so is probably the ideal choice for this.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.