Results 1 to 3 of 3
Thread: [SOLVED] Radio Buttons
- 03-28-2009, 04:51 PM #1
[SOLVED] Radio Buttons
:confused:
I have completed a project using radio buttons that runs fine using the following script
So my way of thinking says that apart from the variables and package names everything should work in whatever package.Java Code:double inch = 0; double kg; double lbs = 0; double cm; double outputInches; double outputLbs = 0; boolean ok; ok = true; String outinch; String outlbs; // try catch for numeric data only try { cm = Double.parseDouble(txtCm.getText());//expect any numerical input } catch (NumberFormatException n) {//to catch none numeric input Optpane.showMessageDialog(this,"Enter numbers only please", "please re-enter",Optpane.ERROR_MESSAGE); // Optpane kicks in on error ok = false; //boolean to trigger Optpane on alpha entry } // start of formula to convert cm to inches and inches to cm - uses class file Units.java cm=Double.parseDouble(txtCm.getText()); outputInches = RbMetric.RadioButtExercise(cm,inch); // Class.PackageName txtInch.setText(outinch=conversions.format(outputInches)); // End of formula
However the following code gives me an error, 'Cannot find symbol, Symbol:Method Bmi31(Double,Double), Location Class bmi31.MetricCm.bmi31, Required Double, Variable inches might not have been initialized.'
I ran the clean build then the initialise error disappeared but the rest is still there, I do not understand why it is telling me i need a double for the class that contains the formula, the program that works does not have it.Java Code:double inchs = 0; double cms; double outputInches; boolean ok; ok = true; String outinch; // try catch for numeric data only try { cms = Double.parseDouble(txtHeight.getText());//expect any numerical input } catch (NumberFormatException n) {//to catch none numeric input optPane1.showMessageDialog(this,"Enter numbers only please", "please re-enter",optPane1.ERROR_MESSAGE); // Optpane kicks in on error ok = false; //boolean to trigger Optpane on alpha entry } // start of formula to convert cm to inches and inches to cm - uses class file Units.java cms=Double.parseDouble(txtHeight.getText()); outputInches = MetricCm.bmi31(cms,inchs); // Class.PackageName txtConvHeight.setText(outinch=bodymass.format(outputInches)); // End of formula
Can someone advise me what the problem is please
Thanks in advance.
-
Does the MetricCm class have a static method bmi31? If so, perhaps you want to show it to us.
I don't see a variable called "inches" though.
- 04-04-2009, 03:44 PM #3
Similar Threads
-
Deselect Radio Buttons
By linux1man in forum AWT / SwingReplies: 7Last Post: 03-21-2009, 04:01 AM -
[B]Tab Sequence problem with radio buttons[/B]
By shobha2k8 in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 08-25-2008, 07:25 AM -
How to use Radio Buttons
By Java Tip in forum SWTReplies: 0Last Post: 07-25-2008, 02:26 PM -
radio buttons and paint
By gtraylo in forum Java AppletsReplies: 1Last Post: 04-19-2008, 12:43 PM -
property for radio buttons
By swapnanair in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 12-03-2007, 08:39 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks