Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package enscustomerprogram;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.FlowLayout;
- import java.awt.GridLayout;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.*;
- /**
- *
- * @author Siphesihle Oliphant
- */
- public class ENSCustomerProgram extends JFrame implements ActionListener
- {
- JLabel name = new JLabel("Customer Name:");
- JTextField txtname = new JTextField(10);
- JLabel sname = new JLabel("Customer Surname:");
- JTextField txtsname = new JTextField(10);
- JLabel num = new JLabel("Customer telephone number:");
- JTextField txtnum = new JTextField(10);
- JLabel a = new JLabel("Customer address:");
- JTextField txta = new JTextField(10);
- JButton r = new JButton("Add Record");
- JButton s = new JButton("Search for Record");
- JButton u = new JButton("Update Record");
- private ImageIcon pic;
- private JLabel label;
- ENSCustomerProgram()
- {
- super("ENS Customer Program");
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setSize(300,300);
- setResizable(false);
- JPanel p = new JPanel();
- p.setLayout(new GridLayout(11,1));
- p.setBackground(Color.white);
- p.add(name);
- p.add(txtname);
- p.add(sname);
- p.add(txtsname);
- p.add(num);
- p.add(txtnum);
- p.add(a);
- p.add(txta);
- p.add(r);
- p.add(s);
- p.add(u);
- add(p);
- pic = new ImageIcon(getClass().getResource("teal.jpg"));
- label = new JLabel(pic);
- add(label);
- r.setToolTipText("click button to add a record");
- s.setToolTipText("click button to search for a record");
- u.setToolTipText("click button to update record");
- r.addActionListener(this);
- s.addActionListener(this);
- u.addActionListener(this);
- getContentPane().setBackground(Color.blue);
- setVisible(true);
- }
- public static void main(String[] args)
- {
- new ENSCustomerProgram();
- // TODO code application logic here
- }
- @Override
- public void actionPerformed(ActionEvent e) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement