开发者

How to draw a panel background before its components

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().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜