David Wismer wrote:Added a Main Sub and the code compiles and does not throw an error when ran, but also does not display anything. FYI, this is the entire code base.
Which is to be expected... your code creates a frame, a panel, a label, and a couple of buttons. It then add the label to the frame and exits. It doesn't use the panel or buttons, nor displays the frame.
Let me fall on my sword This has come up a couple of times before, but it turns out we never intended for you to try to run the code listed on page 3. It was just a sample, not real working code. In our defense, we do have a note at the bottom of the page that says that, but several people have missed that note - our bad.
If you can just hang on for a few more pages you'll get to run a create and run a real program on page 9, and from then on there will be lots of code to write.
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Joined: Dec 19, 2009
Funny! actually glad to have had this little exercise. Anytime you get a chance to problem solve you learn. Time to turn the page.
Hey guys I seems to be having a different error here. I installed JDK and set my path on the bin directory. After I write the Party.java code, exactly the same as on the head first book, I compiled it and this message shown.
Error: Class names, 'Party' , are only accepted if annotation processing is explicitly requested
. . . and then it fails because the Party class as given in the Head First book is not a complete application; it is not intended to be run at all. It says at the bottom left of page 3 it is not meant to be a tutorial, and we'll be writing real code later. It might have been a good idea to say the Party class as given there won't run; lots of people get confused about that. And lots of people get the error you have quoted, myself included, all the time, when I forget to write ".java".