Java 2D graphics

I'm working on a GUI using Java Swing. One of the panels needs to contain 2D graphics, using images, drawing some lines, and placing text on exact locations.

My questions are:
* which swing component can I place this graphic in?
* how do I draw lines?
* do I need to override the paint method?
* How do i place text on exact koordinates?
Who is Participating?
ksivananthConnect With a Mentor Commented:
you can use JPanel and override paintComponent method.

use drawLine, drawImage and drawString method of the Graphics object.
you would typically subclass a JPanel to do custom painting

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.