package schmo; /** * This JFrame allows the user to edit a listing that has already been added * to the database. The user is allowed to edit the number of rooms available, * the price, the start date and the end date of the listing. * * @author Michelle Lee & Joey Pini */ public class EditAListing extends javax.swing.JFrame { /** Creates new form EditAListing */ public EditAListing() { initComponents(); } /** 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() { jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jLabel1 = new javax.swing.JLabel(); hotelNameComboBox = new javax.swing.JComboBox(); jLabel2 = new javax.swing.JLabel(); submitButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); removeListingButton = new javax.swing.JButton(); setTitle("Edit Listings"); setLocationByPlatform(true); 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} }, new String [] { "Number of Rooms", "Price", "Start Date", "End Date" } )); jScrollPane1.setViewportView(jTable1); jLabel1.setText("Hotel Name:"); hotelNameComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" })); jLabel2.setText("Current Listings:"); submitButton.setText("Submit"); submitButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { submitButtonActionPerformed(evt); } }); cancelButton.setText("Cancel"); cancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelButtonActionPerformed(evt); } }); removeListingButton.setText("Remove Listing"); removeListingButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { removeListingButtonActionPerformed(evt); } }); 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(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(removeListingButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 191, Short.MAX_VALUE) .add(submitButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(cancelButton)) .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 432, Short.MAX_VALUE) .add(layout.createSequentialGroup() .add(jLabel1) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(hotelNameComboBox, 0, 369, Short.MAX_VALUE)) .add(jLabel2)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel1) .add(hotelNameComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(16, 16, 16) .add(jLabel2) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 231, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 22, Short.MAX_VALUE) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(cancelButton) .add(submitButton) .add(removeListingButton)) .addContainerGap()) ); pack(); }// //GEN-END:initComponents /** * Defines what happens when the "Remove" button is pressed. */ private void removeListingButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeListingButtonActionPerformed System.out.println("schmo.EditAListing remove listing button pressed..."); RemoveListingDialog removeListingDialog = new RemoveListingDialog(this, true, "Harbor Inn", "January 1", "January 20"); removeListingDialog.setVisible(true); }//GEN-LAST:event_removeListingButtonActionPerformed /** * Defines what happens when the "Submit" button is pressed. */ private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitButtonActionPerformed System.out.println("schmo.EditAListing submit button pressed..."); }//GEN-LAST:event_submitButtonActionPerformed /** * Defines what happens when the "Cancel" button is pressed: this frame * is hidden. */ private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed this.setVisible(false); }//GEN-LAST:event_cancelButtonActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new EditAListing().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton cancelButton; private javax.swing.JComboBox hotelNameComboBox; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTable1; private javax.swing.JButton removeListingButton; private javax.swing.JButton submitButton; // End of variables declaration//GEN-END:variables }