Hello everyone I'm new to the fourm as you all can see. I'm a beginner programer I'm trying to learn Java. I'm work on this simple program to help run my small business. I maintain fish tanks around town. Well I'm trying to create a simple price calculator to help making adding things up and adding the tax. Here is my diagram, and the class that I created and the program. (label) Price of item: (textField)[input box] (label) Number of items: (textField)[input box] (button)[computeButton] (label) Total Price: (textField)[input box] (uneditable) (currency format) (label) Total Tax: (textField)[input box] (uneditable) (currency format) (label) Total Cost: (textField)[input box] (uneditable) (currency format) Code: [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]1 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]import[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] java.awt.*;[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]2 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]import[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] java.awt.event.*;[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]3 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]import[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] javax.swing.*;[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]4 [/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff]5 [/COLOR][/FONT][/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]6 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]public[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]class[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] CalculatePanel [/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]extends[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JPanel {[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]7 [/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff]8 [/COLOR][/FONT][/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]9 [/COLOR][/FONT][/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]10 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]private[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]int[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] Calculate;[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]11 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]private[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JButton push;[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]12 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]private[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JLabel label, label2, label3, label4, label5;[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]13 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]private[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JTextField box, box2, box3, box4, box5;[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]14 [/COLOR][/FONT][/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]15 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]public[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] CalculatePanel () {[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]16 [/COLOR][/FONT][/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]17 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]push = [/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JButton ([/FONT][FONT=Courier New][COLOR=#00cb00][FONT=Courier New][COLOR=#00cb00]"Compute!"[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]18 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]push.addActionListener ([/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] ButtonListener());[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]19 [/COLOR][/FONT][/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]20 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]label = [/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JLabel ([/FONT][FONT=Courier New][COLOR=#00cb00][FONT=Courier New][COLOR=#00cb00]"Calculate: "[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] + Calculate); [/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]21 [/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff]22 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]label = [/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JLabel ([/FONT][FONT=Courier New][COLOR=#00cb00][FONT=Courier New][COLOR=#00cb00]"Price of item: "[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]23 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]label2 = [/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JLabel ([/FONT][FONT=Courier New][COLOR=#00cb00][FONT=Courier New][COLOR=#00cb00]"Number of items: "[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]24 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]label3 = [/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JLabel ([/FONT][FONT=Courier New][COLOR=#00cb00][FONT=Courier New][COLOR=#00cb00]"Total Price: "[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]25 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]label4 = [/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JLabel ([/FONT][FONT=Courier New][COLOR=#00cb00][FONT=Courier New][COLOR=#00cb00]"Total Tax: "[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]26 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]label5 = [/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JLabel ([/FONT][FONT=Courier New][COLOR=#00cb00][FONT=Courier New][COLOR=#00cb00]"Total Cost: "[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]27 [/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff]28 [/COLOR][/FONT][/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]29 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]box = [/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JTextField(5);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]30 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]box2 = [/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JTextField(5);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]31 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]box3 = [/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JTextField(5);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]32 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]box3.setEditable([/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]false[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]33 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]box4 = [/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JTextField(5);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]34 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]box5 = [/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JTextField(5);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]35 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]box5.setEditable([/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]false[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]36 [/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff]37 [/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff]38 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]add (label);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]39 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]add (box);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]40 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]add (label2);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]41 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]add (box2);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]42 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]add (label3);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]43 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]add (box3);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]44 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]add (label4);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]45 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]add (box4);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]46 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]add (label5);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]47 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]add (box5);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]48 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]add (push);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]49 [/COLOR][/FONT][/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]50 [/COLOR][/FONT][/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]51 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]setPreferredSize ([/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] Dimension(190, 225));[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]52 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]setBackground (Color.cyan);}[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]53 [/COLOR][/FONT][/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]54 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]public[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]class[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] ButtonListener [/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]implements[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] ActionListener {[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]55 [/COLOR][/FONT][/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]56 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]public[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]void[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] actionPerformed (ActionEvent event) {[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]57 [/COLOR][/FONT][/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]58 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]int[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] p = Integer.parseInt(box.getText());[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]59 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]int[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] n = Integer.parseInt(box2.getText());[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]60 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]int[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] tp = Integer.parseInt(box3.getText());[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]61 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]int[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] tt = Integer.parseInt(box4.getText());[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]62 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]int[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] tc = Integer.parseInt(box5.getText());[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]63 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]int[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] Calculate = p * n + tp * tt;[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]64 [/COLOR][/FONT][/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]65 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]Calculate++;[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]66 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]box3.setText([/FONT][FONT=Courier New][COLOR=#00cb00][FONT=Courier New][COLOR=#00cb00]".07 "[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] + Calculate);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]67 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]box5.setText([/FONT][FONT=Courier New][COLOR=#00cb00][FONT=Courier New][COLOR=#00cb00]" "[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] + Calculate); }[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]68 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]}[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]69 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]}[/FONT] The Program Runs But It Want Calculate. Code: [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]1 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]import[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] javax.swing.JFrame;[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]2 [/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff]3 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]public[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]class[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] Calculate {[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]4 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#fa6400][FONT=Courier New][COLOR=#fa6400]//-----------------------------------------------------------------[/COLOR][/FONT] [/COLOR][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]5 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#fa6400][FONT=Courier New][COLOR=#fa6400]// Creates the main program frame.[/COLOR][/FONT] [/COLOR][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]6 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#fa6400][FONT=Courier New][COLOR=#fa6400]//-----------------------------------------------------------------[/COLOR][/FONT] [/COLOR][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]7 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]public[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]static[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]void[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] main (String[] args)[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]8 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]{[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]9 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]JFrame frame = [/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] JFrame ([/FONT][FONT=Courier New][COLOR=#00cb00][FONT=Courier New][COLOR=#00cb00]"Calculate"[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]10 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]11 [/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff]12 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]frame.getContentPane().add([/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]new[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New] CalculatePanel());[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]13 [/COLOR][/FONT] [FONT=Courier New][COLOR=#0000ff]14 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]frame.pack();[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]15 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]frame.setVisible([/FONT][FONT=Courier New][COLOR=#941edf][FONT=Courier New][COLOR=#941edf]true[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]);[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]16 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]}[/FONT] [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]17 [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New]}[/FONT] Can anyone Help!!
You really should consider putting a "main" method in CalculatePanel(); This would mean less chance of failure. I am currently testing it. I will get back to you very soon.
for CalculatePanel.java, you were parsing empty JTextFields, Here is the NEW code: HTML: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class CalculatePanel extends JPanel { private int Calculate; private JButton push; private JLabel label, label2, label3, label4, label5; private JTextField box, box2, box3, box4, box5; public CalculatePanel () { push = new JButton ("Compute!"); push.addActionListener (new ButtonListener()); label = new JLabel ("Calculate: " + Calculate); label = new JLabel ("Price of item: "); label2 = new JLabel ("Number of items: "); label3 = new JLabel ("Total Price: "); label4 = new JLabel ("Total Tax: "); label5 = new JLabel ("Total Cost: "); box = new JTextField(5); box2 = new JTextField(5); box3 = new JTextField(5); box3.setEditable(false); box4 = new JTextField(5); box5 = new JTextField(5); box5.setEditable(false); add (label); add (box); add (label2); add (box2); add (label3); add (box3); add (label4); add (box4); add (label5); add (box5); add (push); setPreferredSize (new Dimension(190, 225)); setBackground (Color.cyan);} public class ButtonListener implements ActionListener { public void actionPerformed (ActionEvent event) { double p = Double.parseDouble(box.getText());//price double n = Double.parseDouble(box2.getText());//number of items double tt = Double.parseDouble(box4.getText());//total tax /* * *ANSWER: *These two JTextFields are enabled(false), so you are parsing null. * */ //int tp = Integer.parseInt(box3.getText());//total price //int tc = Integer.parseInt(box5.getText()); //total cost //int Calculate = p * n + tp * tt; double Calculate = p * n + tt; box3.setText(".07 " + Calculate); box5.setText(" " + Calculate); } } } And for Calculate, NO CHANGES: HTML: import javax.swing.JFrame; public class Calculate { //----------------------------------------------------------------- // Creates the main program frame. //----------------------------------------------------------------- public static void main (String[] args) { JFrame frame = new JFrame ("Calculate"); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new CalculatePanel()); frame.pack(); frame.setVisible(true); } }