I'd like to use my Graphics2D object to draw some lines and rectangles on the bac开发者_如何转开发kground of my JFrame's ContentPane, but super.paint(g) completely repaints the panel afterwards, and putting the drawing code after it just puts it on top of the existing components.
How can I draw the panel then my custom drawing code then the components?
JFrame is a Swing component so you should be overriding paintComponent() rather than paint().
精彩评论