1 Replies - 539 Views - Last Post: 22 February 2012 - 10:17 AM Rate Topic: -----

#1 StevoIRL  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 22-February 12

How to properly use Paint() and Repaint() Methods.

Posted 22 February 2012 - 07:32 AM

Hi folks,

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

Is This A Good Question/Topic? 0
  • +

Replies To: How to properly use Paint() and Repaint() Methods.

#2 g00se  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2781
  • View blog
  • Posts: 11,775
  • Joined: 20-September 08

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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1