booking system

  1. /*
  2.  * CreatePanel.java
  3.  * The package panels contains the different class executing the different windows of each function of the FlightSystem Reservation.
  4.  */
  5. package reservation.system.panels;
  6.  
  7. import reservation.system.functions.Create;
  8. import javax.swing.*;
  9. import java.awt.Dimension;
  10.  
  11. /**
  12.  * This class hold Create structure. This object allows to create a new flight in the data base by calling the method <CODE>create</CODE> in {@link reservation.system.FlightSystem}.
  13.  * It use a GUI that contains a form with the several field to fill.
  14.  * @author Texier Mathieu and Frederic Bidon
  15.  */
  16. public class CreatePanel extends Panels {
  17.    
  18.     /** Creates new form CreatePanel */
  19.     public CreatePanel () {
  20.         action = new Create();
  21.        
  22.         rowsInput = new JTextField();
  23.         nameLabel = new JLabel();
  24.         rowsLabel = new JLabel();
  25.         rowLengthInput = new JTextField();
  26.         nameInput = new JTextField();
  27.         rowLengthLabel = new JLabel();
  28.  
  29.         nameLabel.setText("Name");
  30.         add(nameLabel);
  31.         add(nameInput);
  32.         rowLengthLabel.setText("Row Length");
  33.         add(rowLengthLabel);
  34.         add(rowLengthInput);
  35.         rowsLabel.setText("Rows");
  36.         add(rowsLabel);
  37.         add(rowsInput);    
  38.     }
  39.  
  40.   /**
  41.    * Causes this container to lay out its components.
  42.    */
  43.     public void doLayout () {
  44.         nameLabel.setBounds(20, 10, 100, 20);
  45.         nameInput.setBounds(170, 10, 100, 20);
  46.         rowLengthLabel.setBounds(20, 40, 100, 20);
  47.         rowLengthInput.setBounds(170, 40, 100, 20);
  48.         rowsLabel.setBounds(20, 70, 100, 20);
  49.         rowsInput.setBounds(170, 70, 100, 20);
  50.     }    
  51.  
  52.     /**
  53.      * Set the size of the panel
  54.      * @return an instance of Dimension that represents the minimum size of this container.
  55.      */
  56.     public Dimension getMinimumSize () {
  57.         return new Dimension(300,100);
  58.     }
  59.  
  60.     /**
  61.      * Set the size of the panel
  62.      * @return an instance of Dimension that represents the preferred size of this container.
  63.      */
  64.     public Dimension getPreferredSize () {
  65.         return new Dimension(300,100);
  66.     }
  67.    
  68.     /**
  69.      * Proceed the execution of the action
  70.      * @return the result of the request.
  71.      * @param unUsed Not used
  72.      * @throws Exception if the command is not executed.
  73.      */
  74.     public String execute (String[] unUsed) throws Exception {
  75.         String arg[] = {nameInput.getText(), rowsInput.getText(), rowLengthInput.getText()};
  76.         return action.execute(arg);
  77.     }
  78.    
  79.     /**
  80.      * Initialize the number of the field and fill them with default values.
  81.      * Dispaly the label of the Window.
  82.      */
  83.     public void init () {
  84.     }
  85.    
  86.     private JTextField nameInput;
  87.     private JLabel nameLabel;
  88.     private JTextField rowLengthInput;
  89.     private JLabel rowLengthLabel;
  90.     private JTextField rowsInput;
  91.     private JLabel rowsLabel;  
  92. }

contact - link to this site