Guest User

Untitled

a guest
Jan 18th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. import java.awt.*;
  2. import javax.swing.*;
  3. import java.awt.event.*;
  4.  
  5. public class Rooms extends JFrame implements ActionListener{
  6.  
  7. JButton sup, del, exe, rf;
  8.  
  9. public Rooms(){
  10.  
  11. getContentPane().setLayout(null);
  12.  
  13. sup = new JButton("Superior Rooms");
  14. getContentPane().add(sup);
  15. sup.setBounds(10,10,100,100);
  16. sup.addActionListener(this);
  17.  
  18.  
  19. del = new JButton("Deluxe Rooms");
  20. getContentPane().add(del);
  21. del.setBounds(10,40,100,100);
  22. del.addActionListener(this);
  23.  
  24.  
  25. exe = new JButton("Executive Rooms");
  26. getContentPane().add(exe);
  27. exe.setBounds(10,70,100,100);
  28. exe.addActionListener(this);
  29.  
  30. rf = new JButton("Reservation Form");
  31. getContentPane().add(rf);
  32. rf.setBounds(10,450,100,100);
  33. rf.addActionListener(this);
  34.  
  35. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  36.  
  37. }
  38.  
  39. public void actionPerformed(ActionEvent e){
  40. Object source = e.getSource();
  41. if (source==sup){
  42. JLabel img = new JLabel(new ImageIcon("superior.jpg"));
  43. getContentPane().add(img);
  44. }
  45. }
  46.  
  47. public static void main(String[]args){
  48.  
  49. Rooms frm2=new Rooms();
  50. frm2.setTitle("Rooms");
  51. frm2.setVisible(true);
  52. frm2.setResizable(false);
  53. frm2.setBounds(10,100,1000,500);
  54. }
  55. }
Add Comment
Please, Sign In to add comment