Hi All,
I was having trouble with getting my program to display all the necessary conversions. Here is a snippet of the code to help explain what I want to do:
private class CalcListener implements ActionListener{
public void actionPerformed(ActionEvent e){
String centInput, inchInput, meterInput, yardInput;
double cent, inch, meter, yard;
yardInput = yardsText.getText();
inch = Double.parseDouble(yardInput) * 36.00;
cent = Double.parseDouble(yardInput)* 91.44;
meter = Double.parseDouble(yardInput) * 0.9144;
inchText.setText(String.valueOf(inch));
centText.setText(String.valueOf(cent));
meterText.setText(String.valueOf(meter));
This will allow me to put an input into the "Yards" Textfield so that when I click calculate, the inch, cent, and meter Textfields will display their proper conversions. So my question is, How would I be able to make an input in the "Inch" Textfield, so that when I click the calculate button it gives all the conversions to the other units of measurements?(I need to be able to put an input into any textfield and get the proper conversions in the other ones.) But If I put similar code to the one I posted for the different input, I just get errors. I hope that I explained my question thoroughly enough. Thanks for any help in advance!