OpenSeSim/src/Gui/MainWin.java

180 lines
6.2 KiB
Java

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Gui;
import SeSim.Exchange;
/**
*
* @author 7u83 <7u83@mail.ru>
*/
public class MainWin extends javax.swing.JFrame {
static SeSim.Exchange se;
/**
* Creates new form MainWin
*/
public MainWin() {
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.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
jMenuItem1 = new javax.swing.JMenuItem();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
orderBook1 = new Gui.OrderBook();
MainMenu = new javax.swing.JMenuBar();
FileMenu = new javax.swing.JMenu();
FileNew = new javax.swing.JMenuItem();
FileRun = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jMenuItem1.setText("jMenuItem1");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setMinimumSize(new java.awt.Dimension(400, 200));
jLabel1.setText("jLabel1");
getContentPane().add(jLabel1, java.awt.BorderLayout.LINE_START);
jLabel2.setText("jLabel2");
getContentPane().add(jLabel2, java.awt.BorderLayout.CENTER);
jButton2.setText("jButton2");
getContentPane().add(jButton2, java.awt.BorderLayout.LINE_END);
getContentPane().add(orderBook1, java.awt.BorderLayout.PAGE_END);
FileMenu.setBackground(new java.awt.Color(254, 203, 1));
FileMenu.setBorder(null);
FileMenu.setText("File");
FileNew.setText("New");
FileNew.setBorder(null);
FileNew.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
FileNewActionPerformed(evt);
}
});
FileMenu.add(FileNew);
FileRun.setText("Run");
FileRun.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
FileRunActionPerformed(evt);
}
});
FileMenu.add(FileRun);
MainMenu.add(FileMenu);
jMenu2.setText("Edit");
MainMenu.add(jMenu2);
setJMenuBar(MainMenu);
pack();
}// </editor-fold>//GEN-END:initComponents
private void FileNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FileNewActionPerformed
System.out.print("Menu 0 called\n");
}//GEN-LAST:event_FileNewActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed
private void FileRunActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FileRunActionPerformed
se.start();
}//GEN-LAST:event_FileRunActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
se = new Exchange();
SeSim.BuyOrder bo = new SeSim.BuyOrder();
bo.limit=20.0;
bo.size=12;
bo.timestamp=12;
se.SendOrder(bo);
SeSim.BuyOrder bo1 = new SeSim.BuyOrder();
bo1.limit=27.0;
bo1.size=123;
bo1.timestamp=922;
se.SendOrder(bo1);
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MainWin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MainWin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MainWin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MainWin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MainWin().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenu FileMenu;
private javax.swing.JMenuItem FileNew;
private javax.swing.JMenuItem FileRun;
private javax.swing.JMenuBar MainMenu;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuItem jMenuItem1;
private Gui.OrderBook orderBook1;
// End of variables declaration//GEN-END:variables
}