Work on orderbook...
This commit is contained in:
parent
5515dddb30
commit
4028accb96
@ -2,31 +2,6 @@
|
||||
|
||||
<Form version="1.9" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<NonVisualComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JList" name="jList1">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
|
||||
<StringArray count="5">
|
||||
<StringItem index="0" value="Item 1"/>
|
||||
<StringItem index="1" value="Item 2"/>
|
||||
<StringItem index="2" value="Item 3"/>
|
||||
<StringItem index="3" value="Item 4"/>
|
||||
<StringItem index="4" value="Item 5"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="jButton1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="jButton1"/>
|
||||
@ -35,23 +10,43 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="Gui.OrderBook" name="orderBook1">
|
||||
<Component class="javax.swing.JMenuItem" name="jMenuItem1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="jMenuItem1"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Menu class="javax.swing.JMenuBar" name="MainMenu">
|
||||
<SubComponents>
|
||||
<Menu class="javax.swing.JMenu" name="FileMenu">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="1" green="cb" red="fe" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="null"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="File"/>
|
||||
</Properties>
|
||||
<SubComponents>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="FileNew">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="New"/>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="null"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="FileNewActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="FileRun">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Run"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="FileRunActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
</SubComponents>
|
||||
</Menu>
|
||||
<Menu class="javax.swing.JMenu" name="jMenu2">
|
||||
@ -86,12 +81,44 @@
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-66,0,0,2,72"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
|
||||
<Property name="columns" type="int" value="0"/>
|
||||
<Property name="rows" type="int" value="1"/>
|
||||
</Layout>
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="Gui.OrderBook" name="orderBook">
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="jLabel1"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Before"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="jLabel2"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Center"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jButton2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="jButton2"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="After"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="Gui.OrderBook" name="orderBook1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Last"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -13,11 +13,14 @@ import SeSim.Exchange;
|
||||
*/
|
||||
public class MainWin extends javax.swing.JFrame {
|
||||
|
||||
static SeSim.Exchange se;
|
||||
|
||||
|
||||
/**
|
||||
* Creates new form MainWin
|
||||
*/
|
||||
public MainWin() {
|
||||
|
||||
initComponents();
|
||||
}
|
||||
|
||||
@ -30,23 +33,18 @@ public class MainWin extends javax.swing.JFrame {
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
jList1 = new javax.swing.JList<>();
|
||||
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();
|
||||
orderBook = 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();
|
||||
|
||||
jList1.setModel(new javax.swing.AbstractListModel<String>() {
|
||||
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
|
||||
public int getSize() { return strings.length; }
|
||||
public String getElementAt(int i) { return strings[i]; }
|
||||
});
|
||||
jScrollPane1.setViewportView(jList1);
|
||||
|
||||
jButton1.setText("jButton1");
|
||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
@ -54,14 +52,27 @@ public class MainWin extends javax.swing.JFrame {
|
||||
}
|
||||
});
|
||||
|
||||
jMenuItem1.setText("jMenuItem1");
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
setMinimumSize(new java.awt.Dimension(400, 200));
|
||||
getContentPane().setLayout(new java.awt.GridLayout());
|
||||
getContentPane().add(orderBook);
|
||||
|
||||
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);
|
||||
@ -69,6 +80,14 @@ public class MainWin extends javax.swing.JFrame {
|
||||
});
|
||||
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");
|
||||
@ -88,10 +107,30 @@ public class MainWin extends javax.swing.JFrame {
|
||||
// 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.
|
||||
@ -115,10 +154,7 @@ public class MainWin extends javax.swing.JFrame {
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
|
||||
SeSim.Exchange se = new Exchange();
|
||||
se.start();
|
||||
|
||||
|
||||
/* Create and display the form */
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
@ -130,12 +166,14 @@ public class MainWin extends javax.swing.JFrame {
|
||||
// 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.JList<String> jList1;
|
||||
private javax.swing.JButton jButton2;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JMenu jMenu2;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private Gui.OrderBook orderBook;
|
||||
private javax.swing.JMenuItem jMenuItem1;
|
||||
private Gui.OrderBook orderBook1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="2" gridY="0" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="16" weightX="0.0" weightY="0.0"/>
|
||||
<GridBagConstraints gridX="2" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="16" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
@ -32,7 +32,7 @@
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="4" gridY="0" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
|
||||
<GridBagConstraints gridX="8" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
@ -42,7 +42,7 @@
|
||||
</AuxValues>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="2" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
|
||||
<GridBagConstraints gridX="2" gridY="4" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
@ -50,14 +50,11 @@
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JList" name="BidList">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
|
||||
<StringArray count="5">
|
||||
<StringItem index="0" value="Item 1"/>
|
||||
<StringItem index="1" value="Item 2"/>
|
||||
<StringItem index="2" value="Item 3"/>
|
||||
<StringItem index="3" value="Item 4"/>
|
||||
<StringItem index="4" value="Item 5"/>
|
||||
</StringArray>
|
||||
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="bid" type="code"/>
|
||||
</Property>
|
||||
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
|
||||
<Color id="Default Cursor"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[52, 200]"/>
|
||||
@ -76,13 +73,13 @@
|
||||
</AuxValues>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="4" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
|
||||
<GridBagConstraints gridX="6" gridY="4" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JList" name="jList2">
|
||||
<Component class="javax.swing.JList" name="AskList">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
|
||||
<StringArray count="5">
|
||||
@ -104,6 +101,26 @@
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="0" green="0" red="ff" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="20.00"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="4" gridY="0" gridWidth="5" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSeparator" name="jSeparator1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="10" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
<LayoutCode>
|
||||
<CodeStatement>
|
||||
@ -128,7 +145,7 @@
|
||||
<CodeExpression id="2">
|
||||
<ExpressionOrigin>
|
||||
<Value type="[I" editor="org.netbeans.modules.form.layoutsupport.delegates.GridBagLayoutSupport$IntArrayPropertyEditor">
|
||||
<PropertyValue value="[0, 5, 0, 5, 0, 5, 0]"/>
|
||||
<PropertyValue value="[0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0]"/>
|
||||
</Value>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
@ -143,7 +160,7 @@
|
||||
<CodeExpression id="3">
|
||||
<ExpressionOrigin>
|
||||
<Value type="[I" editor="org.netbeans.modules.form.layoutsupport.delegates.GridBagLayoutSupport$IntArrayPropertyEditor">
|
||||
<PropertyValue value="[0, 5, 0]"/>
|
||||
<PropertyValue value="[0, 5, 0, 5, 0]"/>
|
||||
</Value>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
@ -198,7 +215,7 @@
|
||||
<Parameters>
|
||||
<CodeExpression id="7">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
<Value type="int" value="2"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
@ -267,7 +284,7 @@
|
||||
<Parameters>
|
||||
<CodeExpression id="12">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="4"/>
|
||||
<Value type="int" value="8"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
@ -280,7 +297,7 @@
|
||||
<Parameters>
|
||||
<CodeExpression id="13">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
<Value type="int" value="2"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
@ -362,7 +379,20 @@
|
||||
<Parameters>
|
||||
<CodeExpression id="19">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="2"/>
|
||||
<Value type="int" value="4"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="17_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridwidth" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="20">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="3"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
@ -373,7 +403,7 @@
|
||||
<CodeField name="fill" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="20">
|
||||
<CodeExpression id="21">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="1"/>
|
||||
</ExpressionOrigin>
|
||||
@ -386,7 +416,7 @@
|
||||
<CodeField name="weightx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="21">
|
||||
<CodeExpression id="22">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="1.0"/>
|
||||
</ExpressionOrigin>
|
||||
@ -399,7 +429,7 @@
|
||||
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="22_jScrollPane1">
|
||||
<CodeExpression id="23_jScrollPane1">
|
||||
<CodeVariable name="jScrollPane1" type="8194" declaredType="javax.swing.JScrollPane"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
@ -411,7 +441,7 @@
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints">
|
||||
<CodeExpression id="24_gridBagConstraints">
|
||||
<CodeVariable name="gridBagConstraints"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
@ -420,16 +450,29 @@
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<CodeExpression id="24_gridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<CodeExpression id="24_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="24">
|
||||
<CodeExpression id="25">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="6"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="24_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridy" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="26">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="4"/>
|
||||
</ExpressionOrigin>
|
||||
@ -437,25 +480,25 @@
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<CodeExpression id="24_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridy" class="java.awt.GridBagConstraints"/>
|
||||
<CodeField name="gridwidth" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="25">
|
||||
<CodeExpression id="27">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="2"/>
|
||||
<Value type="int" value="3"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<CodeExpression id="24_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="fill" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="26">
|
||||
<CodeExpression id="28">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="1"/>
|
||||
</ExpressionOrigin>
|
||||
@ -463,12 +506,12 @@
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<CodeExpression id="24_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="weightx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="27">
|
||||
<CodeExpression id="29">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="1.0"/>
|
||||
</ExpressionOrigin>
|
||||
@ -481,7 +524,7 @@
|
||||
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="28_jScrollPane2">
|
||||
<CodeExpression id="30_jScrollPane2">
|
||||
<CodeVariable name="jScrollPane2" type="8194" declaredType="javax.swing.JScrollPane"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
@ -489,7 +532,132 @@
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<CodeExpression id="24_gridBagConstraints"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="31_gridBagConstraints">
|
||||
<CodeVariable name="gridBagConstraints"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagConstraints" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="31_gridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="31_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="32">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="4"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="31_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridy" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="33">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="31_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridwidth" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="34">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="5"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="4"/>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="35_jLabel2">
|
||||
<CodeVariable name="jLabel2" type="8194" declaredType="javax.swing.JLabel"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="jLabel2"/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<CodeExpression id="31_gridBagConstraints"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="36_gridBagConstraints">
|
||||
<CodeVariable name="gridBagConstraints"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagConstraints" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="36_gridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="36_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="37">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="10"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="36_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridy" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="38">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="4"/>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="39_jSeparator1">
|
||||
<CodeVariable name="jSeparator1" type="8194" declaredType="javax.swing.JSeparator"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="jSeparator1"/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<CodeExpression id="36_gridBagConstraints"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
</LayoutCode>
|
||||
|
@ -5,16 +5,51 @@
|
||||
*/
|
||||
package Gui;
|
||||
|
||||
//import SeSim.*;
|
||||
import javax.swing.AbstractListModel;
|
||||
import java.util.SortedSet;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class OrderBook extends javax.swing.JPanel {
|
||||
|
||||
/**
|
||||
* Creates new form OrderBook
|
||||
*/
|
||||
private class SListModel extends AbstractListModel {
|
||||
|
||||
SortedSet model;
|
||||
|
||||
public SListModel(SortedSet set) {
|
||||
model = set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
|
||||
SeSim.Order o = (SeSim.Order)model.toArray()[index];
|
||||
|
||||
return o.limit; //model.toArray()[index];
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return model.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
SeSim.Exchange se;
|
||||
|
||||
SListModel bid;
|
||||
|
||||
public OrderBook() {
|
||||
this.se = MainWin.se;
|
||||
bid = new SListModel(se.bid);
|
||||
|
||||
initComponents();
|
||||
}
|
||||
|
||||
@ -33,18 +68,20 @@ public class OrderBook extends javax.swing.JPanel {
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
BidList = new javax.swing.JList<>();
|
||||
jScrollPane2 = new javax.swing.JScrollPane();
|
||||
jList2 = new javax.swing.JList<>();
|
||||
AskList = new javax.swing.JList<>();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
jSeparator1 = new javax.swing.JSeparator();
|
||||
|
||||
java.awt.GridBagLayout layout = new java.awt.GridBagLayout();
|
||||
layout.columnWidths = new int[] {0, 5, 0, 5, 0, 5, 0};
|
||||
layout.rowHeights = new int[] {0, 5, 0};
|
||||
layout.columnWidths = new int[] {0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0};
|
||||
layout.rowHeights = new int[] {0, 5, 0, 5, 0};
|
||||
setLayout(layout);
|
||||
|
||||
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
jLabel1.setText("Bid");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 2;
|
||||
gridBagConstraints.gridy = 0;
|
||||
gridBagConstraints.gridy = 2;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
|
||||
add(jLabel1, gridBagConstraints);
|
||||
@ -52,52 +89,65 @@ public class OrderBook extends javax.swing.JPanel {
|
||||
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
jLabel3.setText("Ask");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 4;
|
||||
gridBagConstraints.gridy = 0;
|
||||
gridBagConstraints.gridx = 8;
|
||||
gridBagConstraints.gridy = 2;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
|
||||
add(jLabel3, gridBagConstraints);
|
||||
|
||||
BidList.setModel(new javax.swing.AbstractListModel<String>() {
|
||||
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
|
||||
public int getSize() { return strings.length; }
|
||||
public String getElementAt(int i) { return strings[i]; }
|
||||
});
|
||||
BidList.setModel(bid);
|
||||
BidList.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
|
||||
BidList.setMinimumSize(new java.awt.Dimension(52, 200));
|
||||
BidList.setName(""); // NOI18N
|
||||
jScrollPane1.setViewportView(BidList);
|
||||
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 2;
|
||||
gridBagConstraints.gridy = 2;
|
||||
gridBagConstraints.gridy = 4;
|
||||
gridBagConstraints.gridwidth = 3;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.weightx = 1.0;
|
||||
add(jScrollPane1, gridBagConstraints);
|
||||
|
||||
jList2.setModel(new javax.swing.AbstractListModel<String>() {
|
||||
AskList.setModel(new javax.swing.AbstractListModel<String>() {
|
||||
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
|
||||
public int getSize() { return strings.length; }
|
||||
public String getElementAt(int i) { return strings[i]; }
|
||||
});
|
||||
jList2.setMinimumSize(new java.awt.Dimension(52, 200));
|
||||
jList2.setName(""); // NOI18N
|
||||
jScrollPane2.setViewportView(jList2);
|
||||
AskList.setMinimumSize(new java.awt.Dimension(52, 200));
|
||||
AskList.setName(""); // NOI18N
|
||||
jScrollPane2.setViewportView(AskList);
|
||||
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 4;
|
||||
gridBagConstraints.gridy = 2;
|
||||
gridBagConstraints.gridx = 6;
|
||||
gridBagConstraints.gridy = 4;
|
||||
gridBagConstraints.gridwidth = 3;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.weightx = 1.0;
|
||||
add(jScrollPane2, gridBagConstraints);
|
||||
|
||||
jLabel2.setForeground(new java.awt.Color(255, 0, 0));
|
||||
jLabel2.setText("20.00");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 4;
|
||||
gridBagConstraints.gridy = 0;
|
||||
gridBagConstraints.gridwidth = 5;
|
||||
add(jLabel2, gridBagConstraints);
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 10;
|
||||
gridBagConstraints.gridy = 0;
|
||||
add(jSeparator1, gridBagConstraints);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JList<String> AskList;
|
||||
private javax.swing.JList<String> BidList;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JList<String> jList2;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JScrollPane jScrollPane2;
|
||||
private javax.swing.JSeparator jSeparator1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ public class Exchange extends Thread {
|
||||
long lastsize;
|
||||
|
||||
// Order orderlist[];
|
||||
TreeSet<BuyOrder> bid = new TreeSet<>();
|
||||
TreeSet<SellOrder> ask = new TreeSet<>();
|
||||
public TreeSet<BuyOrder> bid = new TreeSet<>();
|
||||
public TreeSet<SellOrder> ask = new TreeSet<>();
|
||||
|
||||
private final Semaphore available = new Semaphore(1, true);
|
||||
|
||||
@ -252,7 +252,7 @@ public class Exchange extends Thread {
|
||||
try {
|
||||
sleep(1500);
|
||||
} catch (InterruptedException e) {
|
||||
System.out.println("Interrupted");
|
||||
System.out.println("I was Interrupted");
|
||||
}
|
||||
print_current();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user