Example #1
1
 public static List<PriceBar> getPriceDatas(
     String sym,
     java.util.Date beginDT,
     java.util.Date endDT,
     int priceMagnifier,
     int multiplier) {
   List<PriceBar> priceDatas = new ArrayList<PriceBar>();
   try {
     PreparedStatement datedRangeBySymbol =
         DBopsMySql.datedRangeBySymbol(
             sym, new Timestamp(beginDT.getTime()), new Timestamp(endDT.getTime()));
     ResultSet res = datedRangeBySymbol.executeQuery();
     while (res.next()) {
       PriceBar priceBar =
           new PriceBar(
               res.getTimestamp("datetime").getTime(),
               res.getDouble("open") / priceMagnifier * multiplier,
               res.getDouble("high") / priceMagnifier * multiplier,
               res.getDouble("low") / priceMagnifier * multiplier,
               res.getDouble("close") / priceMagnifier * multiplier,
               res.getLong("volume"));
       priceDatas.add(priceBar);
     }
     // int i = 1;
   } catch (SQLException ex) {
     MsgBox.err2(ex);
   } catch (Exception ex) {
     MsgBox.err2(ex);
   } finally {
     return priceDatas;
   }
 }
Example #2
0
  public void postMaintenanceEventMsg(String msg) {
    try {
      doc.insertString(doc.getLength(), msg + "\n", MsgBox.getStyle("Maintenance"));
    } catch (BadLocationException e) {
      displayError(e.getMessage());
    }

    MsgBox.setCaretPosition(doc.getLength());
  }
Example #3
0
 public static void main(String[] args) {
   try {
     Connection con = DBopsMySql.setuptradesConnection();
     con.setAutoCommit(false);
     String ul = "AUD";
     PreparedStatement pstmt = DBopsMySql.getExpirysForUpdate(con, ul, 20090300, 20100700);
     PreparedStatement upDateStmt = DBopsMySql.updateBeginEndDatesForExpiry(con);
     ResultSet res = pstmt.executeQuery();
     res.next(); // To get a lastexpiry for loop, so should be one extra early expiry
     int lastexp = res.getInt("expiry");
     while (res.next()) {
       int exp = res.getInt("expiry");
       String bdate = DateOps.dbShortFormatString(lastexp - 5);
       String edate = DateOps.dbShortFormatString(exp - 6);
       upDateStmt.setString(1, bdate);
       if (!res.isLast()) {
         upDateStmt.setString(2, edate);
       }
       upDateStmt.setString(3, ul);
       upDateStmt.setInt(4, exp);
       upDateStmt.addBatch();
       lastexp = exp;
     }
     int[] updateCounts = upDateStmt.executeBatch();
     upDateStmt.close();
     con.close();
   } catch (SQLException ex) {
     MsgBox.err2(ex);
   }
 }
Example #4
0
 public static String createCompressionTable(int compressionFactor) {
   String dbTableName = "quotes" + compressionFactor + "min";
   try {
     PreparedStatement createCompressionTable =
         DBopsMySql.setuptradesConnection()
             .prepareStatement(
                 "CREATE TABLE IF NOT EXISTS `Trading`.`"
                     + dbTableName
                     + "` ("
                     + "`symbol` VARCHAR( 15 ) NOT NULL , "
                     + "`datetime` DATETIME NOT NULL , "
                     + "`open` DOUBLE NOT NULL , "
                     + "`high` DOUBLE NOT NULL , "
                     + "`low` DOUBLE NOT NULL , "
                     + "`close` DOUBLE NOT NULL , "
                     + "`volume` BIGINT( 20 ) NOT NULL, "
                     + "PRIMARY KEY(`symbol`, `datetime`))");
     createCompressionTable.execute();
     createCompressionTable.close();
   } catch (SQLException ex) {
     MsgBox.err2(ex);
     dbTableName = null;
   } finally {
     return dbTableName;
   }
 }
Example #5
0
 public void deleteAllMsgs() {
   try {
     doc.remove(0, doc.getLength());
     MsgBox.setCaretPosition(doc.getLength());
   } catch (BadLocationException e) {
     displayError(e.getMessage());
   }
 }
Example #6
0
 public static CallableStatement distinctSymsProc() {
   CallableStatement ret = null;
   try {
     ret = DBopsMySql.setuptradesConnection().prepareCall("CALL distinctQuoteSymbols()");
   } catch (SQLException ex) {
     MsgBox.err2(ex);
   } finally {
     return ret;
   }
 }
Example #7
0
  public mainWindow(Controller c, RandomEventGenerator r, Safety s) {

    // use system look and feel
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      // do nothing
    }

    view = new ElevatorSimView();
    safety = s;
    controller = c;
    randomEventGen = r;
    simStarted = false;

    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    initComponents();

    setGUIEnabled(false);

    SimViewPanel.add(view.getCanvas(), BorderLayout.CENTER);
    this.validate();

    AlgorithmDescBox.setText(controller.getAlgorithmDesc(0));

    doc = MsgBox.getStyledDocument();

    Style style = MsgBox.addStyle("Faults", null);
    StyleConstants.setForeground(style, Color.red);
    StyleConstants.setItalic(style, true);
    StyleConstants.setBold(style, true);

    style = MsgBox.addStyle("Passengers", null);
    StyleConstants.setForeground(style, new Color(0, 204, 204));
    StyleConstants.setItalic(style, true);

    style = MsgBox.addStyle("Normal", null);

    style = MsgBox.addStyle("Elevators", null);
    StyleConstants.setForeground(style, new Color(51, 255, 0));
    StyleConstants.setBold(style, true);

    style = MsgBox.addStyle("Emergs", null);
    StyleConstants.setForeground(style, Color.red);
    StyleConstants.setBold(style, true);

    style = MsgBox.addStyle("Maintenance", null);
    StyleConstants.setForeground(style, Color.ORANGE);
    StyleConstants.setBold(style, true);

    // Hijack the keyboard manager
    KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    manager.addKeyEventDispatcher(new KeyDispatcher(this));

    // add window listener
    this.addWindowListener(new mainWindowListener());
  }
Example #8
0
 public static void insertIntoPaperTradesTable(PaperTrade paperTrade) {
   PreparedStatement pstmt = null;
   try {
     pstmt =
         DBopsMySql.setuptradesConnection()
             .prepareStatement(
                 "INSERT INTO `PaperTrades` "
                     + "(`id`, `EnteredInDB`, `BeginTradeDateTime`, `symbol`, `Position`, "
                     + "`entry`, `stop loss`, `stop risk`, `Stop profit`, "
                     + "`profitpotential`, `Outcome`, `ExitTradeDateTime`) "
                     + "VALUES (NULL, CURRENT_TIMESTAMP, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
     // BeginTradeDateTime
     if (paperTrade.getBeginTradeDateTime() == null) {
       pstmt.setNull(1, Types.DATE);
     } else {
       pstmt.setTimestamp(1, paperTrade.getBeginTradeTimestamp());
     }
     // symbol
     if (paperTrade.getSymbol() == null) {
       pstmt.setNull(2, Types.VARCHAR);
     } else {
       pstmt.setString(2, paperTrade.getSymbol());
     }
     // Position
     if (paperTrade.getPosition() == null) {
       pstmt.setNull(3, Types.VARCHAR);
     } else {
       pstmt.setString(3, paperTrade.getPosition());
     }
     // entry
     pstmt.setDouble(4, paperTrade.getEntry());
     // stop loss
     pstmt.setDouble(5, paperTrade.getStopLoss());
     // stop risk
     pstmt.setDouble(6, paperTrade.getStopRisk());
     // Stop profit
     pstmt.setDouble(7, paperTrade.getProfitStop());
     // profitpotential
     pstmt.setDouble(8, paperTrade.getProfitpotential());
     // Outcome
     pstmt.setDouble(9, paperTrade.getOutcome());
     // ExitTradeDateTime
     pstmt.setTimestamp(10, paperTrade.getExitTradeTimestamp());
     pstmt.execute();
     pstmt.close();
   } catch (SQLException ex) {
     MsgBox.err2(ex);
   } finally {
   }
 }
Example #9
0
  public static Connection setuptradesConnection() {

    try {
      Class.forName("com.mysql.jdbc.Driver");
      tradesConnection =
          DriverManager.getConnection(
              "jdbc:mysql://localhost:3306/Trading", "rickcharon", "1plus7is8");
    } catch (Exception ex) {
      MsgBox.err2(ex);

    } finally {
      return tradesConnection;
    }
  }
Example #10
0
 public static void insertIntoPaperOrdersTable(Order order) {
   PreparedStatement pstmt = null;
   try {
     pstmt =
         DBopsMySql.setuptradesConnection()
             . //// rpc - NOTE:8/15/10 11:35 AM - 22 PARAMS
             prepareStatement(
                 "REPLACE INTO `PaperOrders` "
                     + "(`idx`,`UL`, `Expiry`, `BuySell`, `TotalQuantity`, `FilledQuantity`, "
                     + "`RemainingQuantity`, `LimitPrice`, `Auxprice`, `AvgFillPrice`, `OrderType`, "
                     + "`TIF`, `TranslatedPrice`, `BarTime`, `LossOrGain`, `OCAGroup`, "
                     + "`OcaType`, `OrderID`, `ParentID`, `PermID`, `EntryDateTime`, "
                     + "`ExecutedDateTime`, `Status`)"
                     + "VALUES (?, ? , ?, ?, ?, ?, ?, ?, ? , ?, ?,"
                     + "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
     // IDX
     if (order.getIdx() == null) {
       pstmt.setNull(1, Types.INTEGER);
     } else {
       pstmt.setInt(1, order.getIdx());
     }
     // UL
     if (order.getUl() == null) {
       pstmt.setNull(2, Types.VARCHAR);
     } else {
       pstmt.setString(2, order.getUl());
     }
     // Expiry
     if (order.getExpiry() == null) {
       pstmt.setNull(3, Types.INTEGER);
     } else {
       pstmt.setInt(3, order.getExpiry());
     }
     // BuySell
     if (order.getExpiry() == null) {
       pstmt.setNull(4, Types.VARCHAR);
     } else {
       pstmt.setString(4, order.getBuySell());
     }
     // TotalQuantity
     if (order.getTotalQuantity() == null) {
       pstmt.setNull(5, Types.INTEGER);
     } else {
       pstmt.setInt(5, order.getTotalQuantity());
     }
     // FilledQuantity
     if (order.getFilledQuantity() == null) {
       pstmt.setNull(6, Types.INTEGER);
     } else {
       pstmt.setInt(6, order.getFilledQuantity());
     }
     // RemainingQuantity
     if (order.getRemainingQuantity() == null) {
       pstmt.setNull(7, Types.INTEGER);
     } else {
       pstmt.setInt(7, order.getRemainingQuantity());
     }
     // LimitPrice
     if (order.getLimitPrice() == null) {
       pstmt.setNull(8, Types.DOUBLE);
     } else {
       pstmt.setDouble(8, order.getLimitPrice());
     }
     // AuxPrice
     if (order.getAuxprice() == null) {
       pstmt.setNull(9, Types.DOUBLE);
     } else {
       pstmt.setDouble(9, order.getAuxprice());
     }
     // AvgFillPrice
     if (order.getAvgFillPrice() == null) {
       pstmt.setNull(10, Types.DOUBLE);
     } else {
       pstmt.setDouble(10, order.getAvgFillPrice());
     }
     // OrderType
     if (order.getOrderType() == null) {
       pstmt.setNull(11, Types.VARCHAR);
     } else {
       pstmt.setString(11, order.getOrderType());
     }
     // TIF
     if (order.getTif() == null) {
       pstmt.setNull(12, Types.VARCHAR);
     } else {
       pstmt.setString(12, order.getTif());
     }
     // TranslatedPrice
     if (order.getTranslatedPrice() == null) {
       pstmt.setNull(13, Types.DOUBLE);
     } else {
       pstmt.setDouble(13, order.getTranslatedPrice());
     }
     // BarTime
     if (order.getBarTime() == null) {
       pstmt.setNull(14, Types.DATE);
     } else {
       pstmt.setTimestamp(14, (new Timestamp(order.getBarTime().getTime())));
     }
     // Loss or Gain
     if (order.getLossOrGain() == null) {
       pstmt.setNull(15, Types.DOUBLE);
     } else {
       pstmt.setDouble(15, order.getLossOrGain());
     }
     // OCAGroup
     if (order.getOCAGroup() == null) {
       pstmt.setNull(16, Types.VARCHAR);
     } else {
       pstmt.setString(16, order.getOCAGroup());
     }
     // OCAType
     if (order.getOcaType() == null) {
       pstmt.setNull(17, Types.SMALLINT);
     } else {
       pstmt.setShort(17, order.getOcaType());
     }
     // OrderID
     if (order.getOrderID() == null) {
       pstmt.setNull(18, Types.INTEGER);
     } else {
       pstmt.setInt(18, order.getOrderID());
     }
     // ParentID
     if (order.getParentID() == null) {
       pstmt.setNull(19, Types.INTEGER);
     } else {
       pstmt.setInt(19, order.getParentID());
     }
     // PermID
     if (order.getPermID() == null) {
       pstmt.setNull(20, Types.INTEGER);
     } else {
       pstmt.setInt(20, order.getPermID());
     }
     // EntryDateTime
     if (order.getEntryDateTime() == null) {
       pstmt.setNull(21, Types.DATE);
     } else {
       pstmt.setTimestamp(21, (new Timestamp(order.getEntryDateTime().getTime())));
     }
     // ExecutedDateTime
     if (order.getExecutedDateTime() == null) {
       pstmt.setNull(22, Types.DATE);
     } else {
       pstmt.setTimestamp(22, (new Timestamp(order.getExecutedDateTime().getTime())));
     }
     // Status
     if (order.getStatus() == null) {
       pstmt.setNull(23, Types.VARCHAR);
     } else {
       pstmt.setString(23, order.getStatus());
     }
     pstmt.execute();
     pstmt.close();
   } catch (SQLException ex) {
     MsgBox.err2(ex);
   } finally {
   }
 }
Example #11
0
  private void initComponents() {

    Start_Stop_button = new javax.swing.JButton();
    jScrollPane1 = new javax.swing.JScrollPane();
    MsgBox = new javax.swing.JTextPane();
    SimStatusLabel = new javax.swing.JLabel();
    simStatusLabel = new javax.swing.JLabel();
    SimTimeLabel = new javax.swing.JLabel();
    simTimeLabel = new javax.swing.JLabel();
    ElevatorPane = new javax.swing.JTabbedPane();
    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    AlgorithmDropList = new javax.swing.JComboBox(controller.getAlgorithms());
    jScrollPane2 = new javax.swing.JScrollPane();
    AlgorithmDescBox = new javax.swing.JTextPane();
    PassengerPane = new javax.swing.JTabbedPane();
    jScrollPane3 = new javax.swing.JScrollPane();
    passengerTable = new javax.swing.JTable();
    jPanel3 = new javax.swing.JPanel();
    jScrollPane4 = new javax.swing.JScrollPane();
    FloorPassengerTable = new javax.swing.JTable();
    jLabel2 = new javax.swing.JLabel();
    floorDropDownList = new javax.swing.JComboBox();
    surroundSimViewPanel = new javax.swing.JPanel();
    SimViewPanel = new javax.swing.JPanel(new BorderLayout());
    mainMenuBar = new javax.swing.JMenuBar();
    FileMenu = new javax.swing.JMenu();
    file_newSim = new javax.swing.JMenuItem();
    jSeparator2 = new javax.swing.JPopupMenu.Separator();
    file_quit = new javax.swing.JMenuItem();
    SimViewMenu = new javax.swing.JMenu();
    resetSimView = new javax.swing.JMenuItem();
    jSeparator3 = new javax.swing.JPopupMenu.Separator();
    ElevatorFocusSubMenu = new javax.swing.JMenu();
    jMenuItem5 = new javax.swing.JMenuItem();
    EventsMenu = new javax.swing.JMenu();
    inject_passenger = new javax.swing.JMenuItem();
    jMenu3 = new javax.swing.JMenu();
    injectEmergMenu = new javax.swing.JMenu();
    jMenuItem1 = new javax.swing.JMenuItem();
    jMenu2 = new javax.swing.JMenu();
    inject_fault = new javax.swing.JMenuItem();
    resolve_fault = new javax.swing.JMenuItem();
    jSeparator4 = new javax.swing.JPopupMenu.Separator();
    setup_randomEvents = new javax.swing.JMenuItem();
    halt_randomEvents = new javax.swing.JMenuItem();
    RemoteServerMenu = new javax.swing.JMenu();
    startRemoteServer = new javax.swing.JMenuItem();
    maintenance = new javax.swing.JMenu();
    maintenanceMenu = new javax.swing.JMenu();
    jMenuItem14 = new javax.swing.JMenuItem();
    returnToActiveMenu = new javax.swing.JMenu();
    jMenuItem15 = new javax.swing.JMenuItem();
    jSeparator5 = new javax.swing.JPopupMenu.Separator();
    returnAlltoActive = new javax.swing.JMenuItem();
    jMenu1 = new javax.swing.JMenu();
    graphs_waitTime = new javax.swing.JMenuItem();
    graphs_rideTime = new javax.swing.JMenuItem();
    jSeparator6 = new javax.swing.JSeparator();
    graphs_elevatorPositions = new javax.swing.JMenuItem();
    graphs_distance = new javax.swing.JMenuItem();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("Boss Lift");

    Start_Stop_button.setText("Start/Stop");
    Start_Stop_button.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Start_Stop_buttonActionPerformed(evt);
          }
        });

    MsgBox.setEditable(false);
    jScrollPane1.setViewportView(MsgBox);

    SimStatusLabel.setText("Simulation Status:");

    simStatusLabel.setFont(new java.awt.Font("Tahoma", 1, 11));
    simStatusLabel.setForeground(new java.awt.Color(255, 0, 0));
    simStatusLabel.setText("NOT RUNNING");

    SimTimeLabel.setText("Simulation Time:");

    simTimeLabel.setText("00:00:00");

    jLabel1.setText("Algorithm:");

    AlgorithmDropList.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            AlgorithmDropListActionPerformed(evt);
          }
        });

    AlgorithmDescBox.setBackground(new java.awt.Color(240, 240, 240));
    jScrollPane2.setViewportView(AlgorithmDescBox);

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
        jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel1Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        jPanel1Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                jScrollPane2,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                245,
                                Short.MAX_VALUE)
                            .addGroup(
                                jPanel1Layout
                                    .createSequentialGroup()
                                    .addComponent(jLabel1)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        AlgorithmDropList,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap()));
    jPanel1Layout.setVerticalGroup(
        jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel1Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        jPanel1Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(
                                AlgorithmDropList,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 74, Short.MAX_VALUE)
                    .addContainerGap()));

    ElevatorPane.addTab("Algorithms", jPanel1);

    passengerTable.setModel(new PassengerTableModel());
    passengerTable.setShowHorizontalLines(false);
    passengerTable.setShowVerticalLines(false);
    passengerTable.getTableHeader().setReorderingAllowed(false);
    jScrollPane3.setViewportView(passengerTable);

    PassengerPane.addTab("Passengers", jScrollPane3);

    FloorPassengerTable.setModel(new PassengerTableModel());
    FloorPassengerTable.setShowHorizontalLines(false);
    FloorPassengerTable.setShowVerticalLines(false);
    FloorPassengerTable.getTableHeader().setReorderingAllowed(false);
    jScrollPane4.setViewportView(FloorPassengerTable);

    jLabel2.setText("Floor:");

    javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(
        jPanel3Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel3Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        jPanel3Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                jScrollPane4,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                245,
                                Short.MAX_VALUE)
                            .addGroup(
                                jPanel3Layout
                                    .createSequentialGroup()
                                    .addComponent(jLabel2)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        floorDropDownList,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap()));
    jPanel3Layout.setVerticalGroup(
        jPanel3Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel3Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        jPanel3Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(
                                floorDropDownList,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE)
                    .addContainerGap()));

    PassengerPane.addTab("Floors", jPanel3);

    SimViewPanel.setBackground(new java.awt.Color(0, 0, 0));

    javax.swing.GroupLayout surroundSimViewPanelLayout =
        new javax.swing.GroupLayout(surroundSimViewPanel);
    surroundSimViewPanel.setLayout(surroundSimViewPanelLayout);
    surroundSimViewPanelLayout.setHorizontalGroup(
        surroundSimViewPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                surroundSimViewPanelLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        SimViewPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE)
                    .addContainerGap()));
    surroundSimViewPanelLayout.setVerticalGroup(
        surroundSimViewPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                surroundSimViewPanelLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        SimViewPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)
                    .addContainerGap()));

    FileMenu.setText("File");

    file_newSim.setText("New Simulation");
    file_newSim.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            file_newSimActionPerformed(evt);
          }
        });
    FileMenu.add(file_newSim);
    FileMenu.add(jSeparator2);

    file_quit.setText("Quit");
    file_quit.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            file_quitActionPerformed(evt);
          }
        });
    FileMenu.add(file_quit);

    mainMenuBar.add(FileMenu);

    SimViewMenu.setText("Sim View");

    resetSimView.setText("Reset View to Default");
    resetSimView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            resetSimViewActionPerformed(evt);
          }
        });
    SimViewMenu.add(resetSimView);
    SimViewMenu.add(jSeparator3);

    ElevatorFocusSubMenu.setText("Focus on Elevator...");

    jMenuItem5.setText("(none)");
    jMenuItem5.setEnabled(false);
    ElevatorFocusSubMenu.add(jMenuItem5);

    SimViewMenu.add(ElevatorFocusSubMenu);

    mainMenuBar.add(SimViewMenu);

    EventsMenu.setText("Events");

    inject_passenger.setText("Inject Passenger");
    inject_passenger.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            inject_passengerActionPerformed(evt);
          }
        });
    EventsMenu.add(inject_passenger);

    jMenu3.setText("Passenger Emergency");

    injectEmergMenu.setText("Inject Emergency");

    jMenuItem1.setText("(none)");
    jMenuItem1.setEnabled(false);
    injectEmergMenu.add(jMenuItem1);

    jMenu3.add(injectEmergMenu);

    EventsMenu.add(jMenu3);

    jMenu2.setText("Hardware Faults");

    inject_fault.setText("Inject Fault");
    inject_fault.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            inject_faultActionPerformed(evt);
          }
        });
    jMenu2.add(inject_fault);

    resolve_fault.setText("Resolve Fault");
    resolve_fault.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            resolve_faultActionPerformed(evt);
          }
        });
    jMenu2.add(resolve_fault);

    EventsMenu.add(jMenu2);
    EventsMenu.add(jSeparator4);

    setup_randomEvents.setText("Setup Random Events");
    setup_randomEvents.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            setup_randomEventsActionPerformed(evt);
          }
        });
    EventsMenu.add(setup_randomEvents);

    halt_randomEvents.setText("Halt Random Events");
    halt_randomEvents.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            halt_randomEventsActionPerformed(evt);
          }
        });
    EventsMenu.add(halt_randomEvents);

    mainMenuBar.add(EventsMenu);

    RemoteServerMenu.setText("Remote Server");

    startRemoteServer.setText("Start");
    startRemoteServer.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            startRemoteServerActionPerformed(evt);
          }
        });
    RemoteServerMenu.add(startRemoteServer);

    mainMenuBar.add(RemoteServerMenu);

    maintenance.setText("Maintenance");

    maintenanceMenu.setText("Set Elevator to Maintenance Mode");

    jMenuItem14.setText("(none)");
    jMenuItem14.setEnabled(false);
    maintenanceMenu.add(jMenuItem14);

    maintenance.add(maintenanceMenu);

    returnToActiveMenu.setText("Return Elevator to Active Mode");

    jMenuItem15.setText("(none)");
    jMenuItem15.setEnabled(false);
    returnToActiveMenu.add(jMenuItem15);

    maintenance.add(returnToActiveMenu);
    maintenance.add(jSeparator5);

    returnAlltoActive.setText("Return All to Active Mode");
    returnAlltoActive.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            returnAlltoActiveActionPerformed(evt);
          }
        });
    maintenance.add(returnAlltoActive);

    mainMenuBar.add(maintenance);

    jMenu1.setText("Graphs");

    graphs_waitTime.setText("View Avg. Passenger Wait Time");
    graphs_waitTime.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            graphs_waitTimeActionPerformed(evt);
          }
        });
    jMenu1.add(graphs_waitTime);

    graphs_rideTime.setText("View Avg. Passenger Riding Time");
    graphs_rideTime.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            graphs_rideTimeActionPerformed(evt);
          }
        });
    jMenu1.add(graphs_rideTime);
    jMenu1.add(jSeparator6);

    graphs_elevatorPositions.setText("View Elevator Positions ");
    graphs_elevatorPositions.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            graphs_elevatorPositionsActionPerformed(evt);
          }
        });
    jMenu1.add(graphs_elevatorPositions);

    graphs_distance.setText("View Elevator Distance Traveled");
    graphs_distance.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            graphs_distanceActionPerformed(evt);
          }
        });
    jMenu1.add(graphs_distance);

    mainMenuBar.add(jMenu1);

    setJMenuBar(mainMenuBar);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        surroundSimViewPanel,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(
                                                ElevatorPane,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                278,
                                                Short.MAX_VALUE)
                                            .addComponent(PassengerPane, 0, 278, Short.MAX_VALUE)))
                            .addGroup(
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        jScrollPane1,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        489,
                                        Short.MAX_VALUE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(simStatusLabel)
                                            .addComponent(SimStatusLabel)
                                            .addComponent(
                                                Start_Stop_button,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                172,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addComponent(SimTimeLabel)
                                                    .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement
                                                            .UNRELATED)
                                                    .addComponent(simTimeLabel)))))
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        ElevatorPane,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        165,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        PassengerPane,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        119,
                                        Short.MAX_VALUE))
                            .addComponent(
                                surroundSimViewPanel,
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(SimTimeLabel)
                                            .addComponent(simTimeLabel))
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(SimStatusLabel)
                                    .addGap(3, 3, 3)
                                    .addComponent(simStatusLabel)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        Start_Stop_button,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        51,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(
                                jScrollPane1,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                108,
                                Short.MAX_VALUE))
                    .addContainerGap()));

    pack();
  }