/*
* RemoveListingDialog.java
*
* Created on August 14, 2007, 6:03 AM
*/
package schmo;
import javax.swing.*;
/**
* This JDialog asks the user to confirm removing a listing from the database.
* NOTE: This should probably be replaced by a JOptionPane.showMessageDialog()
* provided by Java.... just a thought.
*
* @author Michelle Lee & Joey Pini
*/
public class RemoveListingDialog extends javax.swing.JDialog {
/** Creates new form RemoveListingDialog */
public RemoveListingDialog(java.awt.Frame parent, boolean modal,
String hotelName, String startDate, String endDate) {
super(parent, modal);
initComponents();
setLabel(hotelName, startDate, endDate);
}
/** Creates new form RemoveListingDialog */
public RemoveListingDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
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() {
jLabel1 = new javax.swing.JLabel();
noButton = new javax.swing.JButton();
yesButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Remove Listing?");
setLocationByPlatform(true);
jLabel1.setText("Are you sure you want to remove the listing for HOTEL which runs from STARTDATE to ENDDATE?");
noButton.setText("No");
noButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
noButtonActionPerformed(evt);
}
});
yesButton.setText("Yes");
yesButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
yesButtonActionPerformed(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(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.add(yesButton)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(noButton)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 69, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(noButton)
.add(yesButton))
.addContainerGap())
);
pack();
}// //GEN-END:initComponents
/**
* Sets the label so that it has the text to alert the user which listing
* is being deleted.
*/
public void setLabel(String hotelName, String startDate, String endDate){
jLabel1.setText(
"Are you sure you want to remove the listing for " +
hotelName + " which runs from " + startDate +
" to " + endDate + "?");
}
/**
* Defines what happens when the "Yes" button is pressed.
*/
private void yesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yesButtonActionPerformed
System.out.println("schmo.RemoveListingDialog yes button pressed...");
}//GEN-LAST:event_yesButtonActionPerformed
/**
* "No" button causes this dialog to be disposed.
*/
private void noButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noButtonActionPerformed
this.dispose();
}//GEN-LAST:event_noButtonActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new RemoveListingDialog(new javax.swing.JFrame(), true).setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JButton noButton;
private javax.swing.JButton yesButton;
// End of variables declaration//GEN-END:variables
}