File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I managed to do it, but...

 
James Brooks
Gunslinger
Ranch Hand
Posts: 165
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic