Currently I have an application which reads in a valid image and displays it on a JPanel. The user can then draw rectangles on this image within the JPanel. The problem I have is that I am unsure on how exactly the Paint() and Repaint() methods work in enabling for these user rectangles to be drawn? In essence I can define the parameters of a rectangle and call paint/repaint() but I have no either if I simply call JPanel.paint(Grahphics g) or JPanel.repaint().
1 Replies - 689 Views - Last Post: 22 February 2012 - 10:17 AM
Replies To: How to properly use Paint() and Repaint() Methods.
Re: How to properly use Paint() and Repaint() Methods.
Posted 22 February 2012 - 10:17 AM
The best way for you to understand is to study the code of an application that does what you want. There's an applet (makes no difference whether applet or application) called 'DrawTest' in the jdk demos.
Page 1 of 1