Retail Calculator

Topics: Item number, Price Pages: 4 (340 words) Published: November 28, 2012
package retail.calculator;
import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat;
import javax.swing.*;

public class RetailCalculator extends JFrame {
//create ojects
JLabel department;
JLabel number;
JLabel name;
JLabel price;
JLabel discount;
JLabel sale;
JComboBox dept;
JTextField itemNum;
JTextField itemName;
JTextField itemPrice;
JTextField itemDisc;
JTextField salePrice;
JButton calculate;
JButton clear;

public RetailCalculator() {
//set object variables
super("Retail Sales Calculator"); //window title
setSize(250, 250); //set window size
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //window close
GridLayout grid = new GridLayout(7, 2);
department = new JLabel("Department");
dept = new JComboBox();
//add ItemListener...combobox and jtextfield
dept.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent ie) {
String str = (String)dept.getSelectedItem();
} //end public void
}); //end item listener
number = new JLabel("Item Number");
itemNum = new JTextField(10);
name = new JLabel("Item Name");
itemName = new JTextField(10);
price = new JLabel("Original Price");
itemPrice = new JTextField(10);
discount = new JLabel("Discount");
itemDisc = new JTextField(10);
sale = new JLabel("Sale Price");...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • History of Calculator Essay
  • Advantages of Calculators Essay
  • Elementary Arithmetic and Calculator Essay
  • Essay about Calculator and Slide Rule
  • Calculator instructions Essay
  • History of Calculators Essay
  • Calculator and Small Hand Device Essay
  • Scientific Calculator Essay

Become a StudyMode Member

Sign Up - It's Free