This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes I managed to do it, but... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "I managed to do it, but..." Watch "I managed to do it, but..." New topic
Author

I managed to do it, but...

James Brooks
Gunslinger
Ranch Hand

Joined: Aug 17, 2006
Posts: 165
Hi gang,

I pulled this one off, but I think my use of the static variable is not really what my book intended for me to do. Can anyone tell me if there is a better way to implement the following problem: Write a JApplet that diplays your name in blue the first time the user clicks a JButton. The second time the user clicks the JButton, make the first name seem to disappear. (Hint: Redraw it using the background color.) At the same time, draw your first name again in a larger font in dark gray.


Hello. My name is Inigo Montoya. You killed my father. Prepare to die.
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42958
    
  73
The field doesn't need to be static, so you can just remove the "static".

Instead of the integer count field, a boolean would suffice, since there are only two states: visible and invisible.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: I managed to do it, but...
 
It's not a secret anymore!