Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import javax.swing.*;
- import java.awt.event.*;
- public class Rooms extends JFrame implements ActionListener{
- JButton sup, del, exe, rf;
- public Rooms(){
- getContentPane().setLayout(null);
- sup = new JButton("Superior Rooms");
- getContentPane().add(sup);
- sup.setBounds(10,10,100,100);
- sup.addActionListener(this);
- del = new JButton("Deluxe Rooms");
- getContentPane().add(del);
- del.setBounds(10,40,100,100);
- del.addActionListener(this);
- exe = new JButton("Executive Rooms");
- getContentPane().add(exe);
- exe.setBounds(10,70,100,100);
- exe.addActionListener(this);
- rf = new JButton("Reservation Form");
- getContentPane().add(rf);
- rf.setBounds(10,450,100,100);
- rf.addActionListener(this);
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
- public void actionPerformed(ActionEvent e){
- Object source = e.getSource();
- if (source==sup){
- JLabel img = new JLabel(new ImageIcon("superior.jpg"));
- getContentPane().add(img);
- }
- }
- public static void main(String[]args){
- Rooms frm2=new Rooms();
- frm2.setTitle("Rooms");
- frm2.setVisible(true);
- frm2.setResizable(false);
- frm2.setBounds(10,100,1000,500);
- }
- }
Add Comment
Please, Sign In to add comment