The Opeartor * is undefined

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 2336 Views - Last Post: 21 February 2011 - 06:43 PM Rate Topic: -----

#16 iceregulus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 21-February 11

Re: The Opeartor * is undefined

Posted 21 February 2011 - 05:49 PM

Ok, I added the JButton "metWeight;" between the class and the constructor, and put the "metWeight = new JButton("Convert to kilograms");" inside the actionPerformed() method, but still nothing, and I tried adding the kilogram, weightOutput, and weightInput to eliminate those errors to, but to no avail. Was what I did even correct?
Was This Post Helpful? 0
  • +
  • -

#17 iceregulus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 21-February 11

Re: The Opeartor * is undefined

Posted 21 February 2011 - 06:43 PM

I apologize for the double post, but I did manage to eliminate the errors related to kilogram, weightOutput, and weightInput, by putting them between the class and the constructor as well. However, the issue with the metWeight still exists. Here's the code that I'm referring to:

public class MetricConverterApp extends JFrame implements ActionListener
	{
		JButton metweight;
		JFormattedTextField weightInput;
		JTextField weightOutput;
		double kilogram = 0.45359;
		
		
		public MetricConverterApp() 
{
...
...
...
if(e.getSource() == metWeight)
       		{
       		    double value = Double.parseDouble(weightInput.getText());
           		weightOutput.setText((value * kilogram) + "");
       		}


Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2