Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

JCheckBox works but doesn't toggle graphically  RSS feed

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying java's swing for the first time with a problem from "Art and Science of Java" with a little program that allows users to fill the canvas with stars upon mouse clicking. I'm trying to make a JCheckBox on the SOUTH border that allows the user to toggle between filled and unfilled stars. The button works properly except that the check mark doesn't toggle when clicked. Otherwise it actually will toggle the stars to be filled or not. Can someone please show me my mistake? Thanks in advance.

 
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Michael said in your thread about a similar problem with JSlider the problem is likely to be in your custom classes.

What keeps you from using classes from the standard JDK? Not everyone has the acm/acmx classes that are required to be able to compile and run your code to try and find out what might be wrong.
 
Joshua Amy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl, thanks for the reply. My reason for the custom classes is only ignorance. I started programming Java watching the Stanford Intro to Programming videos, and Stanford also had some packages to get students started in Eclipse...perhaps this is where my problem lies? As for the code, I copied it directly from "Art and Science of Java" after discovering that the problem happened in several of my programs...I thought I might be doing something wrong repeatedly. The only difference may be that my imports vary slightly (Eclipse does automatic importing, and sometimes I find that my book has imports that are extraneous).

 
Marshal
Posts: 59700
187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Beware: Eclipse has a habit of importing classes in alphabetical order, so classes whose package names begin com. appear before classes beginning java. If you import a class beginning com. because it comes top on Eclipse’s list, that is probably the wrong class. Check your imports carefully for that error.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!