• Post Reply Bookmark Topic Watch Topic
  • New Topic

Questions about the paint( ) method  RSS feed

 
Brandt Charles
Ranch Hand
Posts: 57
Chrome IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The title says it all. I haven't been able to find any good websites explaining it in detail, though I'll peruse the Sun tutorial again. Anyway, how does this method work in a JFrame and applications (not Applets)?

I know it may sound silly, but usually posting GUI/Graphics related topics in the beginner forum results in a prompt redirection to this one from the moderators (this is one of the few message boards where you can't get anything past them).

What I understand of it so far is it gets invoked when the application is started and modified with methods using repaint(). Other than that it's a mystery.

Thanks in advance.

Brandt
 
Nick Meverden
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
READ ME
 
Brandt Charles
Ranch Hand
Posts: 57
Chrome IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link, I was rereading it after I posted. I think in the end my question is this:

Is the paint method automatically invoked when an application is run?

Coincidentally I found another good link for anyone that's interested:

Painting in AWT and Swing
[ July 11, 2006: Message edited by: Brandt Charles ]
 
Nick Meverden
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"whether for the *first time*, in response to becoming unhidden, or because it needs to reflect a change in the program's state"
 
Nick Meverden
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Here's alittle example, run this after the JFrame is visible move something over the JFrame. You will see it's only painted if it's unhidden or something covered over the component and it needs repainting.
[ July 11, 2006: Message edited by: Nick Meverden ]
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!