File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Need HELP Temperature Conversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Need HELP Temperature Conversion" Watch "Need HELP Temperature Conversion" New topic

Need HELP Temperature Conversion

kei hosima

Joined: Feb 23, 2003
Posts: 13
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.

thank you.
kei hosima

Joined: Feb 23, 2003
Posts: 13
Hi. I figured out the pop-up frame part.
Now, when I click a button, nothing happen.
could someone please give me advice.
Thank you

Any suggesion/advice/hints would be greatly appriciated.
Thank you in advance.
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
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

[ February 23, 2003: Message edited by: Layne Lund ]

Java API Documentation
The Java Tutorial
kei hosima

Joined: Feb 23, 2003
Posts: 13
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!
I agree. Here's the link:
subject: Need HELP Temperature Conversion
It's not a secret anymore!