Advertisement
Guest User

Untitled

a guest
May 16th, 2019
1,246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.72 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.awt.*;
  3. import java.util.ArrayList;
  4. import java.util.Arrays;
  5.  
  6. public class NewReservationFrame extends JFrame{
  7.  
  8. private String month, year;
  9. private int day;
  10. private JComboBox months, days, years, rooms, hour, min, AMPM, mealPlans;
  11. private JTextArea fullName, DOB, phoneNum, address, email
  12. , prefMethodOfCon, ccName, ccNum, ccExp, ccCompany
  13. , ccSC, roomNum;
  14. private JLabel nameLabel, DOBLabel, phoneNumLabel, emailLabel
  15. , prefMethodOfConLabel, ccNameLabel, ccNumLabel, ccExpLabel
  16. , ccCompanyLabel, ccSCLabel, addressLabel, guest, room, cc
  17. , roomNameLabel, roomNumLabel, dateLabel, timeLabel, mealPlanLabel;
  18.  
  19. public NewReservationFrame() {
  20. createComponents();
  21. this.setTitle("New Reservation");
  22. this.setExtendedState(JFrame.MAXIMIZED_BOTH);
  23. this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  24.  
  25. //TODO create new reservation frame
  26. }
  27.  
  28. public void createComponents(){
  29. String[] month = {"Jan", "Feb","Mar", "Apr" ,"May", "Jun", "Jul", "Aug",
  30. "Sept", "Oct", "Nov", "Dec"};
  31. String[] year = {"2019", "2020"};
  32. String[] roomSelection = {"Aqua World" , "Small Party Room", "Medium Party Room"
  33. , "Karaoke Lounge", "Adult Billards Lounge"};
  34. String[] days31 = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14",
  35. "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28",
  36. "29", "30", "31"};
  37. String[] hours = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"};
  38. String[] minutes = {"05", "10", "15", "20", "25", "30", "35", "40",
  39. "45", "50", "55"};
  40. String[] timeOfDay = {"AM", "PM"};
  41. String[] mealPlan = {"Basic", "Bronze", "Silver", "Gold", "Platinum"};
  42.  
  43. months = new JComboBox(month);
  44. rooms = new JComboBox(roomSelection);
  45. days = new JComboBox(days31);
  46. years = new JComboBox(year);
  47. AMPM = new JComboBox(timeOfDay);
  48. hour = new JComboBox(hours);
  49. min = new JComboBox(minutes);
  50. mealPlans = new JComboBox(mealPlan);
  51.  
  52.  
  53. fullName = new JTextArea(1, 20);
  54. DOB = new JTextArea(1, 10);
  55. phoneNum = new JTextArea(1, 10);
  56. address = new JTextArea(1, 20);
  57. email = new JTextArea(1, 20);
  58. prefMethodOfCon = new JTextArea(1, 10);
  59. ccName = new JTextArea(1, 20);
  60. ccNum = new JTextArea(1, 16);
  61. ccExp = new JTextArea(1, 5);
  62. ccCompany = new JTextArea(1, 15);
  63. ccSC = new JTextArea(1, 10);
  64. roomNum = new JTextArea(1, 10);
  65.  
  66. nameLabel = new JLabel("Name: ");
  67. DOBLabel = new JLabel("Date Of Birth: ");
  68. phoneNumLabel = new JLabel("Phone Number: ");
  69. addressLabel = new JLabel("Address: ");
  70. emailLabel = new JLabel("Email: ");
  71. prefMethodOfConLabel = new JLabel("Preferred Method of Contact: ");
  72. ccNameLabel = new JLabel("Name on Credit Card: ");
  73. ccNumLabel = new JLabel("Credit Card Number: ");
  74. ccExpLabel = new JLabel("Exp Date: ");
  75. ccCompanyLabel = new JLabel("Company: ");
  76. ccSCLabel = new JLabel("Security Code: ");
  77. guest = new JLabel("Guest Info");
  78. cc = new JLabel("Credit Card");
  79. room = new JLabel("Room");
  80. roomNameLabel = new JLabel("Room Type: ");
  81. roomNumLabel = new JLabel("Room Number");
  82. dateLabel = new JLabel("Date");
  83. timeLabel = new JLabel("Time");
  84. mealPlanLabel = new JLabel("Meal Plans");
  85.  
  86.  
  87. JPanel panel = new JPanel(null);
  88.  
  89. //GUEST INFO
  90. guest.setFont(new Font(Font.SERIF, Font.BOLD, 30));
  91. guest.setBounds(10, 15, 200, 30);
  92. panel.add(guest);
  93.  
  94. //Name
  95. nameLabel.setBounds(10, 50, 50, 10);
  96. panel.add(nameLabel);
  97. fullName.setBounds(55, 50, 300, 15);
  98. panel.add(fullName);
  99.  
  100. //Date of Birth
  101. DOBLabel.setBounds(10, 90, 90, 10);
  102. panel.add(DOBLabel);
  103. DOB.setBounds(100, 90, 100, 15);
  104. panel.add(DOB);
  105.  
  106. //Phone #
  107. phoneNumLabel.setBounds(10, 130, 100, 10);
  108. panel.add(phoneNumLabel);
  109. phoneNum.setBounds(110, 130, 150, 15);
  110. panel.add(phoneNum);
  111.  
  112. //Address
  113. addressLabel.setBounds(10, 170, 100, 10);
  114. panel.add(addressLabel);
  115. address.setBounds(70, 170, 350, 15);
  116. panel.add(address);
  117.  
  118. //Email
  119. emailLabel.setBounds(10, 210, 100, 10);
  120. panel.add(emailLabel);
  121. email.setBounds(60, 210, 300, 15);
  122. panel.add(email);
  123.  
  124. //Preferred Method of Contact
  125. prefMethodOfConLabel.setBounds(10, 250, 200, 10);
  126. panel.add(prefMethodOfConLabel);
  127. prefMethodOfCon.setBounds(200, 250, 200, 15);
  128. panel.add(prefMethodOfCon);
  129.  
  130. //CC INFO
  131. cc.setFont(new Font(Font.SERIF, Font.BOLD, 30));
  132. cc.setBounds(1000, 15, 200, 30);
  133. panel.add(cc);
  134.  
  135. //CC Name
  136. ccNameLabel.setBounds(900, 50 , 200, 10);
  137. panel.add(ccNameLabel);
  138. ccName.setBounds(1050, 50, 350, 15);
  139. panel.add(ccName);
  140.  
  141. //CC Number
  142. ccNumLabel.setBounds(900, 90 , 200, 10);
  143. panel.add(ccNumLabel);
  144. ccNum.setBounds(1030, 90, 350, 15);
  145. panel.add(ccNum);
  146.  
  147. //CC Exp
  148. ccExpLabel.setBounds(900, 130 , 200, 15);
  149. panel.add(ccExpLabel);
  150. ccExp.setBounds(960, 130, 200, 15);
  151. panel.add(ccExp);
  152.  
  153. //CC company
  154. ccCompanyLabel.setBounds(900, 170 , 200, 15);
  155. panel.add(ccCompanyLabel);
  156. ccCompany.setBounds(970, 170, 200, 15);
  157. panel.add(ccCompany);
  158.  
  159. //Security code
  160. ccSCLabel.setBounds(900, 210 , 200, 15);
  161. panel.add(ccSCLabel);
  162. ccSC.setBounds(1000, 210, 200, 15);
  163. panel.add(ccSC);
  164.  
  165. //ROOM INFO
  166. room.setFont(new Font(Font.SERIF, Font.BOLD, 30));
  167. room.setBounds(10, 300, 200, 30);
  168. panel.add(room);
  169.  
  170. //Room Name
  171. roomNameLabel.setBounds(10, 340, 200, 20);
  172. panel.add(roomNameLabel);
  173. rooms.setBounds(90, 325, 200, 50);
  174. panel.add(rooms);
  175. rooms.getSelectedItem();
  176.  
  177. //Room Num
  178. roomNumLabel.setBounds(300, 340, 200, 20);
  179. panel.add(roomNumLabel);
  180. roomNum.setBounds(400, 340, 200, 20);
  181. panel.add(roomNum);
  182.  
  183. //Date
  184. dateLabel.setBounds(10, 380, 200, 20);
  185. panel.add(dateLabel);
  186. months.setBounds(40, 370, 70, 50);
  187. panel.add(months);
  188. months.getSelectedItem();
  189. days.setBounds(110, 370, 70, 50);
  190. panel.add(days);
  191. days.getSelectedItem();
  192. years.setBounds(180, 370, 90, 50);
  193. panel.add(years);
  194. years.getSelectedItem();
  195.  
  196. //Time
  197. timeLabel.setBounds(10, 440, 200, 20);
  198. panel.add(timeLabel);
  199. hour.setBounds(40, 430, 70, 50);
  200. panel.add(hour);
  201. hour.getSelectedItem();
  202. min.setBounds(110, 430, 70, 50);
  203. panel.add(min);
  204. min.getSelectedItem();
  205. AMPM.setBounds(180, 430, 90, 50);
  206. panel.add(AMPM);
  207. AMPM.getSelectedItem();
  208.  
  209. //Meal Plan
  210. mealPlanLabel.setFont(new Font(Font.SERIF, Font.BOLD, 30));
  211. mealPlanLabel.setBounds(1000, 300, 200, 30);
  212. panel.add(mealPlanLabel);
  213. mealPlans.setBounds(1000, 330, 100, 50);
  214. panel.add(mealPlans);
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223. this.add(panel);
  224.  
  225. }
  226.  
  227.  
  228.  
  229. public static void main(String[] args){
  230. NewReservationFrame n = new NewReservationFrame();
  231. n.setVisible(true);
  232. }
  233.  
  234.  
  235.  
  236.  
  237.  
  238. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement