Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.30 KB | None | 0 0
  1. package enscustomerprogram;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.FlowLayout;
  6. import java.awt.GridLayout;
  7. import java.awt.event.ActionEvent;
  8. import java.awt.event.ActionListener;
  9. import javax.swing.*;
  10.  
  11. /**
  12.  *
  13.  * @author Siphesihle Oliphant
  14.  */
  15. public class ENSCustomerProgram extends JFrame implements ActionListener
  16.  
  17. {
  18.     JLabel name = new JLabel("Customer Name:");
  19.     JTextField txtname = new JTextField(10);
  20.    
  21.     JLabel sname = new JLabel("Customer Surname:");
  22.     JTextField txtsname = new JTextField(10);
  23.    
  24.     JLabel num = new JLabel("Customer telephone number:");
  25.     JTextField txtnum = new JTextField(10);
  26.    
  27.     JLabel a = new JLabel("Customer address:");
  28.     JTextField txta = new JTextField(10);
  29.    
  30.     JButton r = new JButton("Add Record");
  31.    
  32.     JButton s = new JButton("Search for Record");
  33.     JButton u = new JButton("Update Record");
  34.    
  35.  private ImageIcon pic;
  36.  private JLabel label;
  37.          
  38.     ENSCustomerProgram()
  39.     {
  40.         super("ENS Customer Program");
  41.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  42.         setSize(300,300);
  43.        
  44.         setResizable(false);
  45.         JPanel p = new JPanel();
  46.      
  47.         p.setLayout(new GridLayout(11,1));
  48.         p.setBackground(Color.white);
  49.         p.add(name);
  50.         p.add(txtname);
  51.         p.add(sname);
  52.         p.add(txtsname);
  53.         p.add(num);
  54.         p.add(txtnum);
  55.         p.add(a);
  56.         p.add(txta);
  57.         p.add(r);
  58.         p.add(s);
  59.         p.add(u);
  60.         add(p);
  61.        
  62.         pic = new ImageIcon(getClass().getResource("teal.jpg"));
  63.         label = new JLabel(pic);
  64.         add(label);
  65.        
  66.         r.setToolTipText("click button to add a record");
  67.         s.setToolTipText("click button to search for a record");
  68.         u.setToolTipText("click button to update record");
  69.         r.addActionListener(this);
  70.         s.addActionListener(this);
  71.         u.addActionListener(this);
  72.         getContentPane().setBackground(Color.blue);
  73.      
  74.         setVisible(true);
  75.        
  76.        
  77.     }
  78.    
  79.  
  80.    
  81.     public static void main(String[] args)
  82.     {
  83.         new ENSCustomerProgram();
  84.         // TODO code application logic here
  85.     }
  86.  
  87.     @Override
  88.     public void actionPerformed(ActionEvent e) {
  89.     }
  90.    
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement