This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
This program is to perform conversions between F and C temperatures. Input Components are input temperature(textfield), Output precision(a choice), conversion to be performed (a group of checkbox objects), output text size(scrollbar), Calculate(button), and a help menu with an about menu item.(displaying pop-up frame). Output component is resulting temperature(Label). I know the code would be placed in the adjustmentValueChanged() method, but I don't know how I could change the label's font (to be larger or smaller) based upon the scrollbar. The pop-up frame, when I click the menu item, the both main frame and menu item frame pop up. How could I chage it so that only menu item frame will pop up? Also, the button is not working. I mean, the whole program is not working... it doesn't calculate.. do anything... Could someone please check my code below and let me know what I should do. thanks
Joined: Feb 23, 2003
Hi. I figured out the pop-up frame part. Now, when I click a button, nothing happen. I mean NOTHING. could someone please give me advice. Thank you
Any suggesion/advice/hints would be greatly appriciated. Thank you in advance.
I bet something DOES happen. Are you compiling and running this program from the command line? If so, you should add some System.out.println() calls inside your ActionPerformed() method to see what is going on. I'll make some comments here about what I *think* is happening, but you should use println() calls to make sure. Let's look at your ActionPerformed method:
The getSource() method returns the object that generated the event. It looks like your first if statement compares this returned object against the String "Convert". I doubt that the event was generated by a String object. Instead, you should use
Oh... that's true. What was I thinking... I changed to 'convButton'. I'm using JBuilder 4 to compile the code. I guess I need to think the if statement little bit more. thank you very much for you help!