Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.awt.*;
- import java.util.ArrayList;
- import java.util.Arrays;
- public class NewReservationFrame extends JFrame{
- private String month, year;
- private int day;
- private JComboBox months, days, years, rooms, hour, min, AMPM, mealPlans;
- private JTextArea fullName, DOB, phoneNum, address, email
- , prefMethodOfCon, ccName, ccNum, ccExp, ccCompany
- , ccSC, roomNum;
- private JLabel nameLabel, DOBLabel, phoneNumLabel, emailLabel
- , prefMethodOfConLabel, ccNameLabel, ccNumLabel, ccExpLabel
- , ccCompanyLabel, ccSCLabel, addressLabel, guest, room, cc
- , roomNameLabel, roomNumLabel, dateLabel, timeLabel, mealPlanLabel;
- public NewReservationFrame() {
- createComponents();
- this.setTitle("New Reservation");
- this.setExtendedState(JFrame.MAXIMIZED_BOTH);
- this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- //TODO create new reservation frame
- }
- public void createComponents(){
- String[] month = {"Jan", "Feb","Mar", "Apr" ,"May", "Jun", "Jul", "Aug",
- "Sept", "Oct", "Nov", "Dec"};
- String[] year = {"2019", "2020"};
- String[] roomSelection = {"Aqua World" , "Small Party Room", "Medium Party Room"
- , "Karaoke Lounge", "Adult Billards Lounge"};
- String[] days31 = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14",
- "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28",
- "29", "30", "31"};
- String[] hours = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"};
- String[] minutes = {"05", "10", "15", "20", "25", "30", "35", "40",
- "45", "50", "55"};
- String[] timeOfDay = {"AM", "PM"};
- String[] mealPlan = {"Basic", "Bronze", "Silver", "Gold", "Platinum"};
- months = new JComboBox(month);
- rooms = new JComboBox(roomSelection);
- days = new JComboBox(days31);
- years = new JComboBox(year);
- AMPM = new JComboBox(timeOfDay);
- hour = new JComboBox(hours);
- min = new JComboBox(minutes);
- mealPlans = new JComboBox(mealPlan);
- fullName = new JTextArea(1, 20);
- DOB = new JTextArea(1, 10);
- phoneNum = new JTextArea(1, 10);
- address = new JTextArea(1, 20);
- email = new JTextArea(1, 20);
- prefMethodOfCon = new JTextArea(1, 10);
- ccName = new JTextArea(1, 20);
- ccNum = new JTextArea(1, 16);
- ccExp = new JTextArea(1, 5);
- ccCompany = new JTextArea(1, 15);
- ccSC = new JTextArea(1, 10);
- roomNum = new JTextArea(1, 10);
- nameLabel = new JLabel("Name: ");
- DOBLabel = new JLabel("Date Of Birth: ");
- phoneNumLabel = new JLabel("Phone Number: ");
- addressLabel = new JLabel("Address: ");
- emailLabel = new JLabel("Email: ");
- prefMethodOfConLabel = new JLabel("Preferred Method of Contact: ");
- ccNameLabel = new JLabel("Name on Credit Card: ");
- ccNumLabel = new JLabel("Credit Card Number: ");
- ccExpLabel = new JLabel("Exp Date: ");
- ccCompanyLabel = new JLabel("Company: ");
- ccSCLabel = new JLabel("Security Code: ");
- guest = new JLabel("Guest Info");
- cc = new JLabel("Credit Card");
- room = new JLabel("Room");
- roomNameLabel = new JLabel("Room Type: ");
- roomNumLabel = new JLabel("Room Number");
- dateLabel = new JLabel("Date");
- timeLabel = new JLabel("Time");
- mealPlanLabel = new JLabel("Meal Plans");
- JPanel panel = new JPanel(null);
- //GUEST INFO
- guest.setFont(new Font(Font.SERIF, Font.BOLD, 30));
- guest.setBounds(10, 15, 200, 30);
- panel.add(guest);
- //Name
- nameLabel.setBounds(10, 50, 50, 10);
- panel.add(nameLabel);
- fullName.setBounds(55, 50, 300, 15);
- panel.add(fullName);
- //Date of Birth
- DOBLabel.setBounds(10, 90, 90, 10);
- panel.add(DOBLabel);
- DOB.setBounds(100, 90, 100, 15);
- panel.add(DOB);
- //Phone #
- phoneNumLabel.setBounds(10, 130, 100, 10);
- panel.add(phoneNumLabel);
- phoneNum.setBounds(110, 130, 150, 15);
- panel.add(phoneNum);
- //Address
- addressLabel.setBounds(10, 170, 100, 10);
- panel.add(addressLabel);
- address.setBounds(70, 170, 350, 15);
- panel.add(address);
- //Email
- emailLabel.setBounds(10, 210, 100, 10);
- panel.add(emailLabel);
- email.setBounds(60, 210, 300, 15);
- panel.add(email);
- //Preferred Method of Contact
- prefMethodOfConLabel.setBounds(10, 250, 200, 10);
- panel.add(prefMethodOfConLabel);
- prefMethodOfCon.setBounds(200, 250, 200, 15);
- panel.add(prefMethodOfCon);
- //CC INFO
- cc.setFont(new Font(Font.SERIF, Font.BOLD, 30));
- cc.setBounds(1000, 15, 200, 30);
- panel.add(cc);
- //CC Name
- ccNameLabel.setBounds(900, 50 , 200, 10);
- panel.add(ccNameLabel);
- ccName.setBounds(1050, 50, 350, 15);
- panel.add(ccName);
- //CC Number
- ccNumLabel.setBounds(900, 90 , 200, 10);
- panel.add(ccNumLabel);
- ccNum.setBounds(1030, 90, 350, 15);
- panel.add(ccNum);
- //CC Exp
- ccExpLabel.setBounds(900, 130 , 200, 15);
- panel.add(ccExpLabel);
- ccExp.setBounds(960, 130, 200, 15);
- panel.add(ccExp);
- //CC company
- ccCompanyLabel.setBounds(900, 170 , 200, 15);
- panel.add(ccCompanyLabel);
- ccCompany.setBounds(970, 170, 200, 15);
- panel.add(ccCompany);
- //Security code
- ccSCLabel.setBounds(900, 210 , 200, 15);
- panel.add(ccSCLabel);
- ccSC.setBounds(1000, 210, 200, 15);
- panel.add(ccSC);
- //ROOM INFO
- room.setFont(new Font(Font.SERIF, Font.BOLD, 30));
- room.setBounds(10, 300, 200, 30);
- panel.add(room);
- //Room Name
- roomNameLabel.setBounds(10, 340, 200, 20);
- panel.add(roomNameLabel);
- rooms.setBounds(90, 325, 200, 50);
- panel.add(rooms);
- rooms.getSelectedItem();
- //Room Num
- roomNumLabel.setBounds(300, 340, 200, 20);
- panel.add(roomNumLabel);
- roomNum.setBounds(400, 340, 200, 20);
- panel.add(roomNum);
- //Date
- dateLabel.setBounds(10, 380, 200, 20);
- panel.add(dateLabel);
- months.setBounds(40, 370, 70, 50);
- panel.add(months);
- months.getSelectedItem();
- days.setBounds(110, 370, 70, 50);
- panel.add(days);
- days.getSelectedItem();
- years.setBounds(180, 370, 90, 50);
- panel.add(years);
- years.getSelectedItem();
- //Time
- timeLabel.setBounds(10, 440, 200, 20);
- panel.add(timeLabel);
- hour.setBounds(40, 430, 70, 50);
- panel.add(hour);
- hour.getSelectedItem();
- min.setBounds(110, 430, 70, 50);
- panel.add(min);
- min.getSelectedItem();
- AMPM.setBounds(180, 430, 90, 50);
- panel.add(AMPM);
- AMPM.getSelectedItem();
- //Meal Plan
- mealPlanLabel.setFont(new Font(Font.SERIF, Font.BOLD, 30));
- mealPlanLabel.setBounds(1000, 300, 200, 30);
- panel.add(mealPlanLabel);
- mealPlans.setBounds(1000, 330, 100, 50);
- panel.add(mealPlans);
- this.add(panel);
- }
- public static void main(String[] args){
- NewReservationFrame n = new NewReservationFrame();
- n.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement