package schmo; import java.util.*; import javax.swing.JComboBox; /** * This JFrame is the main interface for the SCHMO application. The user * primarily uses it to view/search for current listings in the database. * The user can also alter the settings for the application in the * "Administration" tab. * * @author Michelle Lee & Joey Pini */ public class SchmoMainFrame extends javax.swing.JFrame { /** Creates new form SchmoMainFrame */ public SchmoMainFrame() { initComponents(); setDate(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); addButton = new javax.swing.JButton(); editButton = new javax.swing.JButton(); removeButton = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); hotelNameCombo = new javax.swing.JComboBox(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); lowPriceField = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); highPriceField = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); cityCombo = new javax.swing.JComboBox(); searchButton = new javax.swing.JButton(); jSeparator1 = new javax.swing.JSeparator(); monthComboBox = new javax.swing.JComboBox(); dayComboBox = new javax.swing.JComboBox(); jLabel19 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jSeparator3 = new javax.swing.JSeparator(); confirmBookingButton = new javax.swing.JButton(); hotelListingTable = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); hotelInfoButton = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); jLabel7 = new javax.swing.JLabel(); hotelNameTextField = new javax.swing.JTextField(); jLabel8 = new javax.swing.JLabel(); phoneTextField = new javax.swing.JTextField(); jLabel9 = new javax.swing.JLabel(); addressTextField = new javax.swing.JTextField(); jLabel10 = new javax.swing.JLabel(); cityTextField = new javax.swing.JTextField(); jLabel11 = new javax.swing.JLabel(); stateComboBox = new javax.swing.JComboBox(); jLabel12 = new javax.swing.JLabel(); zipTextField = new javax.swing.JTextField(); jSeparator2 = new javax.swing.JSeparator(); jLabel13 = new javax.swing.JLabel(); typeComboBox = new javax.swing.JComboBox(); jLabel14 = new javax.swing.JLabel(); websiteTextField = new javax.swing.JTextField(); addHotelButton = new javax.swing.JButton(); clearButton = new javax.swing.JButton(); chamberMemberCheckBox = new javax.swing.JCheckBox(); jPanel5 = new javax.swing.JPanel(); jLabel15 = new javax.swing.JLabel(); adminIDTextField = new javax.swing.JTextField(); jLabel16 = new javax.swing.JLabel(); passwordField = new javax.swing.JPasswordField(); jLabel17 = new javax.swing.JLabel(); databaseURLTextField = new javax.swing.JTextField(); saveDatabaseButton = new javax.swing.JButton(); jPanel6 = new javax.swing.JPanel(); jLabel18 = new javax.swing.JLabel(); jComboBox3 = new javax.swing.JComboBox(); removeHotelButton = new javax.swing.JButton(); editHotelButton = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("SCHMO: Santa Cruz Hotel Motel Operation"); setBackground(new java.awt.Color(255, 255, 255)); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); setLocationByPlatform(true); addButton.setText("Add"); addButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addButtonActionPerformed(evt); } }); editButton.setText("Edit"); editButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { editButtonActionPerformed(evt); } }); removeButton.setText("Remove"); removeButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { removeButtonActionPerformed(evt); } }); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Search by:")); jLabel1.setText("Hotel Name:"); jLabel2.setText("Check In Date:"); jLabel3.setText("Price:"); jLabel4.setText("between"); lowPriceField.setText("$"); lowPriceField.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { lowPriceFieldFocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { lowPriceFieldFocusLost(evt); } }); jLabel5.setText("&"); highPriceField.setText("$"); highPriceField.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { highPriceFieldFocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { highPriceFieldFocusLost(evt); } }); jLabel6.setText("City:"); cityCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "Aptos", "Capitola", "Soquel", "Santa Cruz", "Watsonville" })); searchButton.setText("Search"); searchButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { searchButtonActionPerformed(evt); } }); monthComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" })); dayComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "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" })); jLabel19.setText("Length of Stay:"); org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel2Layout.createSequentialGroup() .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel2Layout.createSequentialGroup() .addContainerGap() .add(monthComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 115, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(dayComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 124, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 70, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 70, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 116, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) .add(org.jdesktop.layout.GroupLayout.LEADING, jSeparator1) .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel2Layout.createSequentialGroup() .addContainerGap() .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) .add(org.jdesktop.layout.GroupLayout.LEADING, cityCombo, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.LEADING, hotelNameCombo, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel2Layout.createSequentialGroup() .add(jLabel4) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(lowPriceField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 40, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jLabel5) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(highPriceField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 40, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) .add(org.jdesktop.layout.GroupLayout.LEADING, jSeparator3) .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel2Layout.createSequentialGroup() .add(jLabel19) .add(12, 12, 12) .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 80, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) .add(jPanel2Layout.createSequentialGroup() .add(62, 62, 62) .add(searchButton))) .addContainerGap(28, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel2Layout.createSequentialGroup() .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(monthComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(dayComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(17, 17, 17) .add(jSeparator3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(hotelNameCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 22, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(lowPriceField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(highPriceField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jLabel6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(cityCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 22, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 17, Short.MAX_VALUE) .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(searchButton)) ); confirmBookingButton.setText("Confirm Booking"); confirmBookingButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { confirmBookingButtonActionPerformed(evt); } }); hotelListingTable.setMinimumSize(new java.awt.Dimension(20, 10)); hotelListingTable.setPreferredSize(new java.awt.Dimension(452, 402)); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null} }, new String [] { "Hotel Name", "Rooms Available", "Price", "Chamber Member", "Phone", "Address", "City", "State", "Zip" } ) { Class[] types = new Class [] { java.lang.String.class, java.lang.Integer.class, java.lang.String.class, java.lang.Boolean.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } }); jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); jTable1.setCellSelectionEnabled(true); jTable1.setDragEnabled(true); jTable1.setGridColor(new java.awt.Color(192, 192, 192)); hotelListingTable.setViewportView(jTable1); hotelInfoButton.setText("Hotel Info"); hotelInfoButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { hotelInfoButtonActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel1Layout.createSequentialGroup() .addContainerGap() .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup() .add(addButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(editButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(removeButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(hotelInfoButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(confirmBookingButton)) .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup() .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(hotelListingTable, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) .addContainerGap(36, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel1Layout.createSequentialGroup() .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel1Layout.createSequentialGroup() .addContainerGap() .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(jPanel1Layout.createSequentialGroup() .add(19, 19, 19) .add(hotelListingTable, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 374, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(addButton) .add(editButton) .add(removeButton)) .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(confirmBookingButton) .add(hotelInfoButton))) .add(37, 37, 37)) ); jTabbedPane1.addTab("Hotel/Motel Listings", jPanel1); jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Add a Hotel:")); jLabel7.setText("Hotel Name:"); jLabel8.setText("Phone:"); jLabel9.setText("Address:"); jLabel10.setText("City:"); jLabel11.setText("State:"); stateComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "CA" })); jLabel12.setText("Zip:"); jLabel13.setText("Type:"); typeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Hotel", "Motel", "Resort", "B & B", "Campground" })); jLabel14.setText("Website:"); websiteTextField.setText("http://"); addHotelButton.setText("Add Hotel"); addHotelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addHotelButtonActionPerformed(evt); } }); clearButton.setText("Clear"); clearButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { clearButtonActionPerformed(evt); } }); chamberMemberCheckBox.setText("Chamber Member"); chamberMemberCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); chamberMemberCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0)); org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel4Layout.createSequentialGroup() .addContainerGap() .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jSeparator2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 659, Short.MAX_VALUE) .add(jPanel4Layout.createSequentialGroup() .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(jLabel8) .add(jLabel7)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(phoneTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE) .add(hotelNameTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)) .add(29, 29, 29) .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(jLabel9) .add(jLabel10)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(addressTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE) .add(jPanel4Layout.createSequentialGroup() .add(cityTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 89, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jLabel11) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(stateComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jLabel12) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(zipTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)))) .add(jPanel4Layout.createSequentialGroup() .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel4Layout.createSequentialGroup() .add(jLabel13) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(typeComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(32, 32, 32) .add(jLabel14)) .add(chamberMemberCheckBox)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup() .add(addHotelButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(clearButton)) .add(websiteTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 463, Short.MAX_VALUE)))) .addContainerGap()) ); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel4Layout.createSequentialGroup() .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel7) .add(hotelNameTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(addressTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel8) .add(phoneTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel10) .add(cityTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel11) .add(stateComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel12) .add(zipTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jSeparator2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(typeComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel13, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 18, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel14) .add(websiteTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(17, 17, 17) .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(clearButton) .add(addHotelButton) .add(chamberMemberCheckBox)) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Database Connection:")); jLabel15.setText("Administrator ID:"); adminIDTextField.setText("admin"); jLabel16.setText("Password:"); passwordField.setText("******"); jLabel17.setText("Database Host URL:"); saveDatabaseButton.setText("Save Changes"); saveDatabaseButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveDatabaseButtonActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel5Layout.createSequentialGroup() .addContainerGap() .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(jLabel15) .add(jLabel16)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(passwordField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, adminIDTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE)) .add(28, 28, 28) .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(jPanel5Layout.createSequentialGroup() .add(jLabel17) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(databaseURLTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 240, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(saveDatabaseButton)) .addContainerGap()) ); jPanel5Layout.setVerticalGroup( jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel5Layout.createSequentialGroup() .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel15) .add(adminIDTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel17) .add(databaseURLTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(passwordField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE) .add(saveDatabaseButton)) .add(jLabel16, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE)) .addContainerGap()) ); jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Edit/Remove a Hotel:")); jLabel18.setText("Hotel Name:"); removeHotelButton.setText("Remove"); removeHotelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { removeHotelButtonActionPerformed(evt); } }); editHotelButton.setText("Edit"); editHotelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { editHotelButtonActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup( jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel6Layout.createSequentialGroup() .addContainerGap() .add(jLabel18) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jComboBox3, 0, 462, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(editHotelButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(removeHotelButton) .addContainerGap()) ); jPanel6Layout.setVerticalGroup( jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel6Layout.createSequentialGroup() .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel18) .add(removeHotelButton) .add(editHotelButton) .add(jComboBox3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup() .addContainerGap() .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup() .addContainerGap() .add(jPanel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap(95, Short.MAX_VALUE)) ); jTabbedPane1.addTab("Administration", jPanel3); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 720, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 477, Short.MAX_VALUE) .addContainerGap()) ); pack(); }// //GEN-END:initComponents /** * When the high price field loses focus and it is empty a '$' symbol * is placed in the field. */ private void highPriceFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_highPriceFieldFocusLost if(highPriceField.getText().equals("")){ highPriceField.setText("$"); } }//GEN-LAST:event_highPriceFieldFocusLost /** * When the low price field loses focus and it is empty a '$' symbol * is placed in the field. */ private void lowPriceFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_lowPriceFieldFocusLost if(lowPriceField.getText().equals("")){ lowPriceField.setText("$"); } }//GEN-LAST:event_lowPriceFieldFocusLost /** * When the high price field gains focus and it only contains a '$' * symbol, the field is emptied. */ private void highPriceFieldFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_highPriceFieldFocusGained if(highPriceField.getText().equals("$")){ highPriceField.setText(""); } }//GEN-LAST:event_highPriceFieldFocusGained /** * When the low price field gains focus and it only contains a '$' * symbol, the field is emptied. */ private void lowPriceFieldFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_lowPriceFieldFocusGained if(lowPriceField.getText().equals("$")){ lowPriceField.setText(""); } }//GEN-LAST:event_lowPriceFieldFocusGained /** * Defines what happens when the "Remove" button is pressed. A new * instance of the RemoveListingDialog is created with information about * the listing that is to be removed. */ private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed // canned data... RemoveListingDialog removeListingDialog = new RemoveListingDialog(this, true, "Seacliff Inn Best Western", "July 14", "July 15"); removeListingDialog.setVisible(true); }//GEN-LAST:event_removeButtonActionPerformed /** * Sets the date in the search bar. */ public void setDate() { Calendar now = Calendar.getInstance(); monthComboBox.setSelectedIndex(now.get(Calendar.MONTH)); dayComboBox.setSelectedIndex(now.get(Calendar.DAY_OF_MONTH)-1); } /** * Defines what happens when the "Hotel Info" button is pressed. */ private void hotelInfoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hotelInfoButtonActionPerformed System.out.println("schmo.SchmoMainFrame hotel info button pressed..."); }//GEN-LAST:event_hotelInfoButtonActionPerformed /** * Defines what happens when the "Save Changes" button in the database * connection panel is pressed. */ private void saveDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveDatabaseButtonActionPerformed System.out.println("schmo.SchmoMainFrame save changes button pressed"); }//GEN-LAST:event_saveDatabaseButtonActionPerformed /** * Defines what happens when the "Remove" button in the hotel info panel is * pressed. */ private void removeHotelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeHotelButtonActionPerformed System.out.println("schmo.SchmoMainFrame remove button pressed..."); }//GEN-LAST:event_removeHotelButtonActionPerformed /** * Defines what happens when the "Edit" button in the hotel info panel is * pressed: a new instance of the EditHotelInfo frame is created and set * as visible. */ private void editHotelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editHotelButtonActionPerformed EditHotelInfo editHotelInfo = new EditHotelInfo(); editHotelInfo.setVisible(true); }//GEN-LAST:event_editHotelButtonActionPerformed /** * Defines what happens when the "Add Hotel" button is pressed: the hotel * is added to the live database. */ private void addHotelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addHotelButtonActionPerformed System.out.println("schmo.SchmoMainFrame add hotel button pressed..."); }//GEN-LAST:event_addHotelButtonActionPerformed /** * Defines what happens when the "Clear" button is pressed: all the fields * in the "Add A Hotel" panel are cleared. */ private void clearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearButtonActionPerformed hotelNameTextField.setText(""); addressTextField.setText(""); phoneTextField.setText(""); cityTextField.setText(""); stateComboBox.setSelectedIndex(0); zipTextField.setText(""); typeComboBox.setSelectedIndex(0); websiteTextField.setText("http://"); chamberMemberCheckBox.setSelected(false); }//GEN-LAST:event_clearButtonActionPerformed /** * Defines what happens when the "Search" button is pressed. */ private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchButtonActionPerformed System.out.println("schmo.SchmoMainFrame search button pressed..."); }//GEN-LAST:event_searchButtonActionPerformed /** * Defines what happens when the "Edit" button is pressed: a new instance * of the EditAListing frame is created and set as visible. */ private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed EditAListing editAListing = new EditAListing(); editAListing.setVisible(true); }//GEN-LAST:event_editButtonActionPerformed /** * Defines what happens when the "Confirm Booking" button is pressed: a new * instance of the ConfirmDialogBox is created and set as visible. */ private void confirmBookingButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_confirmBookingButtonActionPerformed ConfirmDialogBox confirmDialogBox = new ConfirmDialogBox(this, true); confirmDialogBox.setVisible(true); }//GEN-LAST:event_confirmBookingButtonActionPerformed /** * Defines what happens when the "Add" button is pressed. A new instance * of the AddAListing frame is created and set as visible. */ private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed AddAListing addAListing = new AddAListing(); addAListing.setVisible(true); }//GEN-LAST:event_addButtonActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new SchmoMainFrame().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton addButton; private javax.swing.JButton addHotelButton; private javax.swing.JTextField addressTextField; private javax.swing.JTextField adminIDTextField; private javax.swing.JCheckBox chamberMemberCheckBox; private javax.swing.JComboBox cityCombo; private javax.swing.JTextField cityTextField; private javax.swing.JButton clearButton; private javax.swing.JButton confirmBookingButton; private javax.swing.JTextField databaseURLTextField; private javax.swing.JComboBox dayComboBox; private javax.swing.JButton editButton; private javax.swing.JButton editHotelButton; private javax.swing.JTextField highPriceField; private javax.swing.JButton hotelInfoButton; private javax.swing.JScrollPane hotelListingTable; private javax.swing.JComboBox hotelNameCombo; private javax.swing.JTextField hotelNameTextField; private javax.swing.JComboBox jComboBox3; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JSeparator jSeparator1; private javax.swing.JSeparator jSeparator2; private javax.swing.JSeparator jSeparator3; private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JTable jTable1; private javax.swing.JTextField jTextField1; private javax.swing.JTextField lowPriceField; private javax.swing.JComboBox monthComboBox; private javax.swing.JPasswordField passwordField; private javax.swing.JTextField phoneTextField; private javax.swing.JButton removeButton; private javax.swing.JButton removeHotelButton; private javax.swing.JButton saveDatabaseButton; private javax.swing.JButton searchButton; private javax.swing.JComboBox stateComboBox; private javax.swing.JComboBox typeComboBox; private javax.swing.JTextField websiteTextField; private javax.swing.JTextField zipTextField; // End of variables declaration//GEN-END:variables }