This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes paint() and repaint() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "paint() and repaint()" Watch "paint() and repaint()" New topic

paint() and repaint()

Jesse Walker
Ranch Hand

Joined: Aug 18, 2004
Posts: 50
Just a quick question, I am trying to build a program that will let you click a button to change the background color of a frame. in my actionPerformed method I have the following

if(ae.getSource() == red1) {

That is where I am stuck, I know I need to call repaint() but what should I put in the paint() method? I have nothing in it right now but was thinking that I should put the actual code that makes the frame visible is that right??
Thanks in advance
Jesse Walker
Ranch Hand

Joined: Aug 18, 2004
Posts: 50
Nevermind figured out on my own
Don't get me started about those stupid light bulbs.
subject: paint() and repaint()
It's not a secret anymore!