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.
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.
There are no new questions, but there may be new answers.
Joined: Dec 17, 2011
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).
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.
subject: JCheckBox works but doesn't toggle graphically