I have been trying to figure out these errors and I am stuck. You guys are good at seeing what I can not, thanks!
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class GUIWindow extends JFrame{ //private Circle circ = new Circle(); private JLabel radiusLabel = new JLabel("Radius"); private JLabel areaLabel = new JLabel("Area"); private TextField radiusField = new JTextField("3.14"); private TextField areaField = new JTextField("0.0"); private JButton radButton = new JButton("Convert >>>"); public GUIWindow(){ JPanel dataPanel = new JPanel(new GridLayout(2,2,12,6)); dataPanel.add(radiusLabel); dataPanel.add(areaLabel); dataPanel.add(radiusField); dataPanel.add(areaField); JPanel buttonPanel = new JPanel(); buttonPanel.add(radButton); Container container = getContentPane(); container.add(dataPanel, BorderLayout.CENTER); container.add(buttonPanel, BorderLayout.SOUTH); radButton.addActionListener(new RadiusListener()); } private class RadiusListener implements ActionListener{ public void actionPerformed(ActionEvent e){ String input = radiusField.getText(); double rad = Double.parseDouble(input); rad.setRadius(rad); double area = rad.getArea(); areaField.setText("" + area); } } }
the errors:
E:\JavaCh8SR\ConvertWithGUI.java:10: cannot find symbol
symbol : method setVisable(boolean)
location: class GUIWindow
theGUI.setVisable(true);
^
.\GUIWindow.java:11: incompatible types
found : javax.swing.JTextField
required: java.awt.TextField
private TextField radiusField = new JTextField("3.14");
^
.\GUIWindow.java:12: incompatible types
found : javax.swing.JTextField
required: java.awt.TextField
private TextField areaField = new JTextField("0.0");
^
.\GUIWindow.java:35: double cannot be dereferenced
rad.setRadius(rad);
^
.\GUIWindow.java:36: double cannot be dereferenced
double area = rad.getArea();
^
and the main: