Interface improved
This commit is contained in:
parent
167fee1502
commit
d1e84ccbb2
18
nb-configuration.xml
Normal file
18
nb-configuration.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<netbeans.hint.license>bsd</netbeans.hint.license>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
@ -2,13 +2,16 @@
|
|||||||
|
|
||||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||||
|
<Color blue="ff" green="ff" id="white" palette="1" red="ff" type="palette"/>
|
||||||
|
</Property>
|
||||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||||
<Border info="org.netbeans.modules.form.compat2.border.BevelBorderInfo">
|
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||||
<BevelBorder/>
|
<TitledBorder/>
|
||||||
</Border>
|
</Border>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||||
<Dimension value="[900, 300]"/>
|
<Dimension value="[300, 300]"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
@ -27,12 +30,12 @@
|
|||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<EmptySpace min="0" pref="396" max="32767" attributes="0"/>
|
<EmptySpace min="0" pref="316" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<EmptySpace min="0" pref="296" max="32767" attributes="0"/>
|
<EmptySpace min="0" pref="280" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
@ -5,31 +5,91 @@
|
|||||||
*/
|
*/
|
||||||
package chart;
|
package chart;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import sesim.Exchange.*;
|
||||||
|
import sesim.Quote;
|
||||||
|
import gui.MainWin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author 7u83 <7u83@mail.ru>
|
* @author 7u83 <7u83@mail.ru>
|
||||||
*/
|
*/
|
||||||
public class Chart extends javax.swing.JPanel {
|
public class Chart extends javax.swing.JPanel implements QuoteReceiver{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form Chart
|
* Creates new form Chart
|
||||||
*/
|
*/
|
||||||
public Chart() {
|
public Chart() {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
|
MainWin.se.addQuoteReceiver(this);
|
||||||
|
|
||||||
//Graphics g = this.getGraphics();
|
//Graphics g = this.getGraphics();
|
||||||
//g.drawString("Hello world", 0, 0);
|
//g.drawString("Hello world", 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int item_width=10;
|
||||||
|
int items=350;
|
||||||
|
|
||||||
|
|
||||||
|
OHLCData data;
|
||||||
|
|
||||||
|
|
||||||
|
OHLCDataItem current=null;
|
||||||
|
|
||||||
|
private void realTimeAdd(long time,float price,float volume){
|
||||||
|
if (current==null){
|
||||||
|
current=new OHLCDataItem(price,price,price,price,volume);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean rc = current.update(price,volume);
|
||||||
|
if (rc){
|
||||||
|
System.out.print("Updated -"
|
||||||
|
+" High:"
|
||||||
|
+current.high
|
||||||
|
+" Low:"
|
||||||
|
+current.low
|
||||||
|
+" Volume"
|
||||||
|
+current.volume
|
||||||
|
+"\n"
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void getData(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void draw(Graphics2D g){
|
||||||
|
this.getSize();
|
||||||
|
|
||||||
|
int pwidth = item_width*items;
|
||||||
|
|
||||||
|
this.setPreferredSize(new Dimension(pwidth,400));
|
||||||
|
|
||||||
|
for (int i=0; i<items; i++){
|
||||||
|
int x=i*this.item_width;
|
||||||
|
g.drawLine(x, 0, x, 50);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paintComponent(Graphics go) {
|
public void paintComponent(Graphics go) {
|
||||||
super.paintComponent(go);
|
super.paintComponent(go);
|
||||||
|
|
||||||
Graphics2D g = (Graphics2D) go;
|
Graphics2D g = (Graphics2D) go;
|
||||||
|
|
||||||
g.setColor(Color.BLUE);
|
g.setColor(Color.GRAY);
|
||||||
|
|
||||||
g.setBackground(Color.BLACK);
|
g.setBackground(Color.BLACK);
|
||||||
// g.get
|
// g.get
|
||||||
@ -40,11 +100,12 @@ public class Chart extends javax.swing.JPanel {
|
|||||||
//g.fillRect(0, 0, 100, 100);
|
//g.fillRect(0, 0, 100, 100);
|
||||||
Dimension d = this.getSize();
|
Dimension d = this.getSize();
|
||||||
|
|
||||||
g.drawString("Hello world", 810, 10);
|
//g.drawString("Hello world", 810, 10);
|
||||||
g.drawLine(0, 0, d.width, d.height);
|
//g.drawLine(0, 0, d.width, d.height);
|
||||||
|
|
||||||
|
//this.setPreferredSize(new Dimension(2000,4000));
|
||||||
|
|
||||||
|
draw(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,22 +117,29 @@ public class Chart extends javax.swing.JPanel {
|
|||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
setBackground(java.awt.Color.white);
|
||||||
setPreferredSize(new java.awt.Dimension(900, 300));
|
setBorder(javax.swing.BorderFactory.createTitledBorder(""));
|
||||||
|
setPreferredSize(new java.awt.Dimension(300, 300));
|
||||||
setRequestFocusEnabled(false);
|
setRequestFocusEnabled(false);
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
this.setLayout(layout);
|
this.setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGap(0, 396, Short.MAX_VALUE)
|
.addGap(0, 316, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGap(0, 296, Short.MAX_VALUE)
|
.addGap(0, 280, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void UpdateQuote(Quote q) {
|
||||||
|
// System.out.print("Quote Received\n");
|
||||||
|
this.realTimeAdd(q.time, (float)q.price , q.volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
84
src/main/java/chart/FullChart.form
Normal file
84
src/main/java/chart/FullChart.form
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||||
|
<AuxValues>
|
||||||
|
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||||
|
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||||
|
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||||
|
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||||
|
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||||
|
</AuxValues>
|
||||||
|
|
||||||
|
<Layout>
|
||||||
|
<DimensionLayout dim="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="jScrollPane1" pref="763" max="32767" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="legend1" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
<DimensionLayout dim="1">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="legend1" max="32767" attributes="0"/>
|
||||||
|
<Component id="jScrollPane1" pref="321" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
</Layout>
|
||||||
|
<SubComponents>
|
||||||
|
<Container class="chart.Legend" name="legend1">
|
||||||
|
<Properties>
|
||||||
|
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||||
|
<Color blue="cc" green="cc" red="ff" type="rgb"/>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
|
||||||
|
<Layout>
|
||||||
|
<DimensionLayout dim="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<EmptySpace min="0" pref="75" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
<DimensionLayout dim="1">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
</Layout>
|
||||||
|
</Container>
|
||||||
|
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||||
|
|
||||||
|
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||||
|
<SubComponents>
|
||||||
|
<Container class="chart.Chart" name="chart1">
|
||||||
|
|
||||||
|
<Layout>
|
||||||
|
<DimensionLayout dim="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<EmptySpace min="0" pref="737" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
<DimensionLayout dim="1">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<EmptySpace min="0" pref="295" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
</Layout>
|
||||||
|
</Container>
|
||||||
|
</SubComponents>
|
||||||
|
</Container>
|
||||||
|
</SubComponents>
|
||||||
|
</Form>
|
108
src/main/java/chart/FullChart.java
Normal file
108
src/main/java/chart/FullChart.java
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 7u83 <7u83@mail.ru>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package chart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author 7u83 <7u83@mail.ru>
|
||||||
|
*/
|
||||||
|
public class FullChart extends javax.swing.JPanel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates new form FullChart
|
||||||
|
*/
|
||||||
|
public FullChart() {
|
||||||
|
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() {
|
||||||
|
|
||||||
|
legend1 = new chart.Legend();
|
||||||
|
jScrollPane1 = new javax.swing.JScrollPane();
|
||||||
|
chart1 = new chart.Chart();
|
||||||
|
|
||||||
|
legend1.setBackground(new java.awt.Color(255, 204, 204));
|
||||||
|
|
||||||
|
javax.swing.GroupLayout legend1Layout = new javax.swing.GroupLayout(legend1);
|
||||||
|
legend1.setLayout(legend1Layout);
|
||||||
|
legend1Layout.setHorizontalGroup(
|
||||||
|
legend1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGap(0, 75, Short.MAX_VALUE)
|
||||||
|
);
|
||||||
|
legend1Layout.setVerticalGroup(
|
||||||
|
legend1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGap(0, 0, Short.MAX_VALUE)
|
||||||
|
);
|
||||||
|
|
||||||
|
javax.swing.GroupLayout chart1Layout = new javax.swing.GroupLayout(chart1);
|
||||||
|
chart1.setLayout(chart1Layout);
|
||||||
|
chart1Layout.setHorizontalGroup(
|
||||||
|
chart1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGap(0, 737, Short.MAX_VALUE)
|
||||||
|
);
|
||||||
|
chart1Layout.setVerticalGroup(
|
||||||
|
chart1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGap(0, 295, Short.MAX_VALUE)
|
||||||
|
);
|
||||||
|
|
||||||
|
jScrollPane1.setViewportView(chart1);
|
||||||
|
|
||||||
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
|
this.setLayout(layout);
|
||||||
|
layout.setHorizontalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addContainerGap()
|
||||||
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 763, Short.MAX_VALUE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(legend1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addContainerGap())
|
||||||
|
);
|
||||||
|
layout.setVerticalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addContainerGap()
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(legend1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE))
|
||||||
|
.addContainerGap())
|
||||||
|
);
|
||||||
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
|
||||||
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private chart.Chart chart1;
|
||||||
|
private javax.swing.JScrollPane jScrollPane1;
|
||||||
|
private chart.Legend legend1;
|
||||||
|
// End of variables declaration//GEN-END:variables
|
||||||
|
}
|
28
src/main/java/chart/Legend.form
Normal file
28
src/main/java/chart/Legend.form
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||||
|
<AuxValues>
|
||||||
|
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||||
|
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||||
|
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||||
|
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||||
|
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||||
|
</AuxValues>
|
||||||
|
|
||||||
|
<Layout>
|
||||||
|
<DimensionLayout dim="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
<DimensionLayout dim="1">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
</Layout>
|
||||||
|
</Form>
|
65
src/main/java/chart/Legend.java
Normal file
65
src/main/java/chart/Legend.java
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 7u83 <7u83@mail.ru>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package chart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author 7u83 <7u83@mail.ru>
|
||||||
|
*/
|
||||||
|
public class Legend extends javax.swing.JPanel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates new form Legend
|
||||||
|
*/
|
||||||
|
public Legend() {
|
||||||
|
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() {
|
||||||
|
|
||||||
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
|
this.setLayout(layout);
|
||||||
|
layout.setHorizontalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGap(0, 400, Short.MAX_VALUE)
|
||||||
|
);
|
||||||
|
layout.setVerticalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGap(0, 300, Short.MAX_VALUE)
|
||||||
|
);
|
||||||
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
|
||||||
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
// End of variables declaration//GEN-END:variables
|
||||||
|
}
|
145
src/main/java/chart/NewJPanel.form
Normal file
145
src/main/java/chart/NewJPanel.form
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||||
|
<AuxValues>
|
||||||
|
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||||
|
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||||
|
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||||
|
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||||
|
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||||
|
</AuxValues>
|
||||||
|
|
||||||
|
<Layout>
|
||||||
|
<DimensionLayout dim="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="jToolBar1" max="32767" attributes="0"/>
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="jScrollPane2" pref="245" max="32767" attributes="0"/>
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<Component id="jCheckBox1" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="jScrollPane3" pref="0" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||||
|
<Component id="jButton1" pref="137" max="32767" attributes="0"/>
|
||||||
|
<Component id="jScrollPane1" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
<DimensionLayout dim="1">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<Component id="jToolBar1" min="-2" pref="25" max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="jButton1" min="-2" pref="95" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Group type="102" alignment="1" attributes="0">
|
||||||
|
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
|
||||||
|
<Component id="jScrollPane2" min="-2" pref="93" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="jScrollPane1" alignment="0" pref="197" max="32767" attributes="0"/>
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<Component id="jCheckBox1" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Component id="jScrollPane3" alignment="0" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
</Layout>
|
||||||
|
<SubComponents>
|
||||||
|
<Container class="javax.swing.JToolBar" name="jToolBar1">
|
||||||
|
<Properties>
|
||||||
|
<Property name="rollover" type="boolean" value="true"/>
|
||||||
|
</Properties>
|
||||||
|
|
||||||
|
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||||
|
</Container>
|
||||||
|
<Component class="javax.swing.JButton" name="jButton1">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="jButton1"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<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>
|
||||||
|
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
|
||||||
|
<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.JTextArea" name="jTextArea1">
|
||||||
|
<Properties>
|
||||||
|
<Property name="columns" type="int" value="20"/>
|
||||||
|
<Property name="rows" type="int" value="5"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
</SubComponents>
|
||||||
|
</Container>
|
||||||
|
<Component class="javax.swing.JCheckBox" name="jCheckBox1">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="jCheckBox1"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Container class="javax.swing.JScrollPane" name="jScrollPane3">
|
||||||
|
<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.JTextArea" name="jTextArea2">
|
||||||
|
<Properties>
|
||||||
|
<Property name="columns" type="int" value="20"/>
|
||||||
|
<Property name="rows" type="int" value="5"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
</SubComponents>
|
||||||
|
</Container>
|
||||||
|
</SubComponents>
|
||||||
|
</Form>
|
136
src/main/java/chart/NewJPanel.java
Normal file
136
src/main/java/chart/NewJPanel.java
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 7u83 <7u83@mail.ru>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package chart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author 7u83 <7u83@mail.ru>
|
||||||
|
*/
|
||||||
|
public class NewJPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates new form NewJPanel
|
||||||
|
*/
|
||||||
|
public NewJPanel() {
|
||||||
|
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() {
|
||||||
|
|
||||||
|
jToolBar1 = new javax.swing.JToolBar();
|
||||||
|
jButton1 = new javax.swing.JButton();
|
||||||
|
jScrollPane1 = new javax.swing.JScrollPane();
|
||||||
|
jList1 = new javax.swing.JList<>();
|
||||||
|
jScrollPane2 = new javax.swing.JScrollPane();
|
||||||
|
jTextArea1 = new javax.swing.JTextArea();
|
||||||
|
jCheckBox1 = new javax.swing.JCheckBox();
|
||||||
|
jScrollPane3 = new javax.swing.JScrollPane();
|
||||||
|
jTextArea2 = new javax.swing.JTextArea();
|
||||||
|
|
||||||
|
jToolBar1.setRollover(true);
|
||||||
|
|
||||||
|
jButton1.setText("jButton1");
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
jTextArea1.setColumns(20);
|
||||||
|
jTextArea1.setRows(5);
|
||||||
|
jScrollPane2.setViewportView(jTextArea1);
|
||||||
|
|
||||||
|
jCheckBox1.setText("jCheckBox1");
|
||||||
|
|
||||||
|
jTextArea2.setColumns(20);
|
||||||
|
jTextArea2.setRows(5);
|
||||||
|
jScrollPane3.setViewportView(jTextArea2);
|
||||||
|
|
||||||
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
|
this.setLayout(layout);
|
||||||
|
layout.setHorizontalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addContainerGap()
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addComponent(jCheckBox1)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||||
|
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE)
|
||||||
|
.addComponent(jScrollPane1))))
|
||||||
|
.addContainerGap())
|
||||||
|
);
|
||||||
|
layout.setVerticalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
|
.addGap(8, 8, 8)
|
||||||
|
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addComponent(jCheckBox1)
|
||||||
|
.addGap(0, 0, Short.MAX_VALUE))
|
||||||
|
.addComponent(jScrollPane3))
|
||||||
|
.addContainerGap())
|
||||||
|
);
|
||||||
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
|
||||||
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private javax.swing.JButton jButton1;
|
||||||
|
private javax.swing.JCheckBox jCheckBox1;
|
||||||
|
private javax.swing.JList<String> jList1;
|
||||||
|
private javax.swing.JScrollPane jScrollPane1;
|
||||||
|
private javax.swing.JScrollPane jScrollPane2;
|
||||||
|
private javax.swing.JScrollPane jScrollPane3;
|
||||||
|
private javax.swing.JTextArea jTextArea1;
|
||||||
|
private javax.swing.JTextArea jTextArea2;
|
||||||
|
private javax.swing.JToolBar jToolBar1;
|
||||||
|
// End of variables declaration//GEN-END:variables
|
||||||
|
}
|
53
src/main/java/chart/OHLCData.java
Normal file
53
src/main/java/chart/OHLCData.java
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 7u83 <7u83@mail.ru>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package chart;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author 7u83 <7u83@mail.ru>
|
||||||
|
*/
|
||||||
|
public class OHLCData extends ArrayList <OHLCDataItem> {
|
||||||
|
|
||||||
|
float max;
|
||||||
|
|
||||||
|
long start_time;
|
||||||
|
long time_step;
|
||||||
|
|
||||||
|
public float getMax(){
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean add (OHLCDataItem o){
|
||||||
|
super.add(o);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
68
src/main/java/chart/OHLCDataItem.java
Normal file
68
src/main/java/chart/OHLCDataItem.java
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 7u83 <7u83@mail.ru>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package chart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author 7u83 <7u83@mail.ru>
|
||||||
|
*/
|
||||||
|
public class OHLCDataItem {
|
||||||
|
|
||||||
|
public float open;
|
||||||
|
public float high;
|
||||||
|
public float low;
|
||||||
|
public float close;
|
||||||
|
public float volume;
|
||||||
|
|
||||||
|
public OHLCDataItem(float open, float high, float low, float close, float volume) {
|
||||||
|
this.open = open;
|
||||||
|
this.high = high;
|
||||||
|
this.low = low;
|
||||||
|
this.close = close;
|
||||||
|
this.volume = volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OHLCDataItem() {
|
||||||
|
this(0, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean update(float price, float volume) {
|
||||||
|
boolean ret = false;
|
||||||
|
if (price > high) {
|
||||||
|
high = price;
|
||||||
|
ret = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (price < low) {
|
||||||
|
low = price;
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
this.volume = this.volume + volume;
|
||||||
|
this.close = price;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -11,65 +11,96 @@
|
|||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||||
<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,44,0,0,1,-112"/>
|
|
||||||
</AuxValues>
|
</AuxValues>
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
|
<Layout>
|
||||||
<Property name="columns" type="int" value="0"/>
|
<DimensionLayout dim="0">
|
||||||
<Property name="rows" type="int" value="3"/>
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="jLabel1" min="-2" pref="63" max="-2" attributes="0"/>
|
||||||
|
<Component id="jLabel2" min="-2" pref="50" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="jTextField2" max="32767" attributes="0"/>
|
||||||
|
<Component id="jTextField1" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<EmptySpace pref="37" max="32767" attributes="0"/>
|
||||||
|
<Component id="jButton1" min="-2" pref="65" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="jButton2" min="-2" pref="70" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
<DimensionLayout dim="1">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||||
|
<Component id="jTextField1" max="32767" attributes="0"/>
|
||||||
|
<Component id="jLabel1" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="jLabel2" min="-2" pref="25" max="-2" attributes="0"/>
|
||||||
|
<Component id="jTextField2" alignment="0" min="-2" pref="27" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace pref="358" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Component class="javax.swing.JButton" name="SellButton">
|
<Component class="javax.swing.JButton" name="jButton1">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
<Property name="text" type="java.lang.String" value="Byu"/>
|
||||||
<Color blue="c" green="0" red="b5" type="rgb"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
|
|
||||||
<FontInfo relative="true">
|
|
||||||
<Font bold="true" component="SellButton" property="font" relativeSize="true" size="12"/>
|
|
||||||
</FontInfo>
|
|
||||||
</Property>
|
|
||||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
|
||||||
<Color blue="fe" green="fe" red="fe" type="rgb"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="text" type="java.lang.String" value="Sell"/>
|
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="SellButtonActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
<Component class="javax.swing.JButton" name="jButton2">
|
||||||
<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.JTextArea" name="jTextArea1">
|
|
||||||
<Properties>
|
|
||||||
<Property name="columns" type="int" value="20"/>
|
|
||||||
<Property name="rows" type="int" value="5"/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
<Component class="javax.swing.JButton" name="BuyButton">
|
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
<Property name="text" type="java.lang.String" value="Sell"/>
|
||||||
<Color blue="1" green="5e" red="5" type="rgb"/>
|
</Properties>
|
||||||
</Property>
|
</Component>
|
||||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
|
<Component class="javax.swing.JTextField" name="jTextField1">
|
||||||
<FontInfo relative="true">
|
<Properties>
|
||||||
<Font bold="true" component="BuyButton" property="font" relativeSize="true" size="12"/>
|
<Property name="text" type="java.lang.String" value="325"/>
|
||||||
</FontInfo>
|
|
||||||
</Property>
|
|
||||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
|
||||||
<Color blue="fe" green="fe" red="fe" type="rgb"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="text" type="java.lang.String" value="Buy"/>
|
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="BuyButtonActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField1ActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Shares:"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Limit:"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JTextField" name="jTextField2">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="127.00"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField2ActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
|
@ -47,55 +47,99 @@ public class ControlPanel extends javax.swing.JPanel {
|
|||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
SellButton = new javax.swing.JButton();
|
jButton1 = new javax.swing.JButton();
|
||||||
jScrollPane1 = new javax.swing.JScrollPane();
|
jButton2 = new javax.swing.JButton();
|
||||||
jTextArea1 = new javax.swing.JTextArea();
|
jTextField1 = new javax.swing.JTextField();
|
||||||
BuyButton = new javax.swing.JButton();
|
jLabel1 = new javax.swing.JLabel();
|
||||||
|
jLabel2 = new javax.swing.JLabel();
|
||||||
|
jTextField2 = new javax.swing.JTextField();
|
||||||
|
|
||||||
setLayout(new java.awt.GridLayout(3, 0));
|
jButton1.setText("Byu");
|
||||||
|
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||||
SellButton.setBackground(new java.awt.Color(181, 0, 12));
|
|
||||||
SellButton.setFont(SellButton.getFont().deriveFont(SellButton.getFont().getStyle() | java.awt.Font.BOLD, SellButton.getFont().getSize()+12));
|
|
||||||
SellButton.setForeground(new java.awt.Color(254, 254, 254));
|
|
||||||
SellButton.setText("Sell");
|
|
||||||
SellButton.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
SellButtonActionPerformed(evt);
|
jButton1ActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
add(SellButton);
|
|
||||||
|
|
||||||
jTextArea1.setColumns(20);
|
jButton2.setText("Sell");
|
||||||
jTextArea1.setRows(5);
|
|
||||||
jScrollPane1.setViewportView(jTextArea1);
|
|
||||||
|
|
||||||
add(jScrollPane1);
|
jTextField1.setText("325");
|
||||||
|
jTextField1.addActionListener(new java.awt.event.ActionListener() {
|
||||||
BuyButton.setBackground(new java.awt.Color(5, 94, 1));
|
|
||||||
BuyButton.setFont(BuyButton.getFont().deriveFont(BuyButton.getFont().getStyle() | java.awt.Font.BOLD, BuyButton.getFont().getSize()+12));
|
|
||||||
BuyButton.setForeground(new java.awt.Color(254, 254, 254));
|
|
||||||
BuyButton.setText("Buy");
|
|
||||||
BuyButton.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
BuyButtonActionPerformed(evt);
|
jTextField1ActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
add(BuyButton);
|
|
||||||
|
jLabel1.setText("Shares:");
|
||||||
|
|
||||||
|
jLabel2.setText("Limit:");
|
||||||
|
|
||||||
|
jTextField2.setText("127.00");
|
||||||
|
jTextField2.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
jTextField2ActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
|
this.setLayout(layout);
|
||||||
|
layout.setHorizontalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(jTextField2)
|
||||||
|
.addComponent(jTextField1)))
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addContainerGap(37, Short.MAX_VALUE)
|
||||||
|
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||||
|
.addContainerGap())
|
||||||
|
);
|
||||||
|
layout.setVerticalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addContainerGap()
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||||
|
.addComponent(jTextField1)
|
||||||
|
.addComponent(jLabel1, 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)
|
||||||
|
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(jButton1)
|
||||||
|
.addComponent(jButton2))
|
||||||
|
.addContainerGap(358, Short.MAX_VALUE))
|
||||||
|
);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
private void SellButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SellButtonActionPerformed
|
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||||
MainWin.myAccount.sell(81, 55.0);
|
// TODO add your handling code here:
|
||||||
}//GEN-LAST:event_SellButtonActionPerformed
|
}//GEN-LAST:event_jButton1ActionPerformed
|
||||||
|
|
||||||
private void BuyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BuyButtonActionPerformed
|
private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed
|
||||||
MainWin.myAccount.buy(44, 66.0);
|
// TODO add your handling code here:
|
||||||
}//GEN-LAST:event_BuyButtonActionPerformed
|
}//GEN-LAST:event_jTextField2ActionPerformed
|
||||||
|
|
||||||
|
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
|
||||||
|
// TODO add your handling code here:
|
||||||
|
}//GEN-LAST:event_jTextField1ActionPerformed
|
||||||
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JButton BuyButton;
|
private javax.swing.JButton jButton1;
|
||||||
private javax.swing.JButton SellButton;
|
private javax.swing.JButton jButton2;
|
||||||
private javax.swing.JScrollPane jScrollPane1;
|
private javax.swing.JLabel jLabel1;
|
||||||
private javax.swing.JTextArea jTextArea1;
|
private javax.swing.JLabel jLabel2;
|
||||||
|
private javax.swing.JTextField jTextField1;
|
||||||
|
private javax.swing.JTextField jTextField2;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,19 @@
|
|||||||
<Property name="text" type="java.lang.String" value="Edit"/>
|
<Property name="text" type="java.lang.String" value="Edit"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
<Menu class="javax.swing.JMenu" name="jMenu1">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Help"/>
|
||||||
|
</Properties>
|
||||||
|
<SubComponents>
|
||||||
|
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem2">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="About"/>
|
||||||
|
<Property name="toolTipText" type="java.lang.String" value="About this Software"/>
|
||||||
|
</Properties>
|
||||||
|
</MenuItem>
|
||||||
|
</SubComponents>
|
||||||
|
</Menu>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Menu>
|
</Menu>
|
||||||
</NonVisualComponents>
|
</NonVisualComponents>
|
||||||
@ -75,7 +88,7 @@
|
|||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||||
<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,2,93,0,0,2,-69"/>
|
<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,2,93,0,0,3,-30"/>
|
||||||
</AuxValues>
|
</AuxValues>
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||||
@ -94,31 +107,12 @@
|
|||||||
</Constraint>
|
</Constraint>
|
||||||
</Constraints>
|
</Constraints>
|
||||||
</Component>
|
</Component>
|
||||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
<Component class="chart.FullChart" name="fullChart2">
|
||||||
<Constraints>
|
<Constraints>
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||||
<BorderConstraints direction="Center"/>
|
<BorderConstraints direction="Center"/>
|
||||||
</Constraint>
|
</Constraint>
|
||||||
</Constraints>
|
</Constraints>
|
||||||
|
</Component>
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
|
||||||
<SubComponents>
|
|
||||||
<Container class="chart.Chart" name="chart2">
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="231" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="572" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -41,7 +41,7 @@ import javax.swing.*;
|
|||||||
*/
|
*/
|
||||||
public class MainWin extends javax.swing.JFrame {
|
public class MainWin extends javax.swing.JFrame {
|
||||||
|
|
||||||
static sesim.Exchange se;
|
static public sesim.Exchange se;
|
||||||
static sesim.Account myAccount;
|
static sesim.Account myAccount;
|
||||||
static traders.ManTrader myTrader;
|
static traders.ManTrader myTrader;
|
||||||
|
|
||||||
@ -52,7 +52,15 @@ public class MainWin extends javax.swing.JFrame {
|
|||||||
|
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
|
AutoTraderLIst at = new AutoTraderLIst();
|
||||||
|
// RandomTraderConfig rcfg = new RandomTraderConfig();
|
||||||
|
SwitchingTraderConfig rcfg = new SwitchingTraderConfig();
|
||||||
|
at.add(1000, rcfg, se, 100, 0);
|
||||||
|
at.add(1000, rcfg, se, 0, 10000);
|
||||||
|
|
||||||
|
|
||||||
|
SwitchingTraderConfig scfg = new SwitchingTraderConfig();
|
||||||
|
at.add(1, scfg, se, 1000000, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,13 +77,14 @@ public class MainWin extends javax.swing.JFrame {
|
|||||||
jMenuItem1 = new javax.swing.JMenuItem();
|
jMenuItem1 = new javax.swing.JMenuItem();
|
||||||
controlPanel2 = new gui.ControlPanel();
|
controlPanel2 = new gui.ControlPanel();
|
||||||
orderBookPanel1 = new gui.OrderBookPanel();
|
orderBookPanel1 = new gui.OrderBookPanel();
|
||||||
jScrollPane1 = new javax.swing.JScrollPane();
|
fullChart2 = new chart.FullChart();
|
||||||
chart2 = new chart.Chart();
|
|
||||||
MainMenu = new javax.swing.JMenuBar();
|
MainMenu = new javax.swing.JMenuBar();
|
||||||
FileMenu = new javax.swing.JMenu();
|
FileMenu = new javax.swing.JMenu();
|
||||||
FileNew = new javax.swing.JMenuItem();
|
FileNew = new javax.swing.JMenuItem();
|
||||||
FileRun = new javax.swing.JMenuItem();
|
FileRun = new javax.swing.JMenuItem();
|
||||||
jMenu2 = new javax.swing.JMenu();
|
jMenu2 = new javax.swing.JMenu();
|
||||||
|
jMenu1 = new javax.swing.JMenu();
|
||||||
|
jMenuItem2 = new javax.swing.JMenuItem();
|
||||||
|
|
||||||
jButton1.setText("jButton1");
|
jButton1.setText("jButton1");
|
||||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||||
@ -90,21 +99,7 @@ public class MainWin extends javax.swing.JFrame {
|
|||||||
setMinimumSize(new java.awt.Dimension(640, 480));
|
setMinimumSize(new java.awt.Dimension(640, 480));
|
||||||
getContentPane().add(controlPanel2, java.awt.BorderLayout.LINE_END);
|
getContentPane().add(controlPanel2, java.awt.BorderLayout.LINE_END);
|
||||||
getContentPane().add(orderBookPanel1, java.awt.BorderLayout.LINE_START);
|
getContentPane().add(orderBookPanel1, java.awt.BorderLayout.LINE_START);
|
||||||
|
getContentPane().add(fullChart2, java.awt.BorderLayout.CENTER);
|
||||||
javax.swing.GroupLayout chart2Layout = new javax.swing.GroupLayout(chart2);
|
|
||||||
chart2.setLayout(chart2Layout);
|
|
||||||
chart2Layout.setHorizontalGroup(
|
|
||||||
chart2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 231, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
chart2Layout.setVerticalGroup(
|
|
||||||
chart2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 572, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
jScrollPane1.setViewportView(chart2);
|
|
||||||
|
|
||||||
getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
|
|
||||||
|
|
||||||
FileMenu.setBackground(new java.awt.Color(254, 203, 1));
|
FileMenu.setBackground(new java.awt.Color(254, 203, 1));
|
||||||
FileMenu.setText("File");
|
FileMenu.setText("File");
|
||||||
@ -131,6 +126,14 @@ public class MainWin extends javax.swing.JFrame {
|
|||||||
jMenu2.setText("Edit");
|
jMenu2.setText("Edit");
|
||||||
MainMenu.add(jMenu2);
|
MainMenu.add(jMenu2);
|
||||||
|
|
||||||
|
jMenu1.setText("Help");
|
||||||
|
|
||||||
|
jMenuItem2.setText("About");
|
||||||
|
jMenuItem2.setToolTipText("About this Software");
|
||||||
|
jMenu1.add(jMenuItem2);
|
||||||
|
|
||||||
|
MainMenu.add(jMenu1);
|
||||||
|
|
||||||
setJMenuBar(MainMenu);
|
setJMenuBar(MainMenu);
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
@ -171,27 +174,19 @@ public class MainWin extends javax.swing.JFrame {
|
|||||||
tr.start();
|
tr.start();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AutoTraderLIst at = new AutoTraderLIst();
|
|
||||||
// RandomTraderConfig rcfg = new RandomTraderConfig();
|
|
||||||
SwitchingTraderConfig rcfg = new SwitchingTraderConfig();
|
|
||||||
at.add(1000, rcfg, se, 100, 0);
|
|
||||||
at.add(1000, rcfg, se, 0, 10000);
|
|
||||||
|
|
||||||
|
|
||||||
SwitchingTraderConfig scfg = new SwitchingTraderConfig();
|
|
||||||
at.add(1, scfg, se, 1000000, 0);
|
|
||||||
|
|
||||||
|
|
||||||
// at.add(10, rcfg, se, 1000000, 0);
|
// at.add(10, rcfg, se, 1000000, 0);
|
||||||
|
|
||||||
|
|
||||||
try {
|
/* try {
|
||||||
// Set cross-platform Java L&F (also called "Metal")
|
// Set cross-platform Java L&F (also called "Metal")
|
||||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
|
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
|
||||||
} catch (UnsupportedLookAndFeelException | ClassNotFoundException |
|
} catch (UnsupportedLookAndFeelException | ClassNotFoundException |
|
||||||
InstantiationException | IllegalAccessException e) {
|
InstantiationException | IllegalAccessException e) {
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/* Set the Nimbus look and feel */
|
/* Set the Nimbus look and feel */
|
||||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
//<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.
|
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||||
@ -229,12 +224,13 @@ public class MainWin extends javax.swing.JFrame {
|
|||||||
private javax.swing.JMenuItem FileNew;
|
private javax.swing.JMenuItem FileNew;
|
||||||
private javax.swing.JMenuItem FileRun;
|
private javax.swing.JMenuItem FileRun;
|
||||||
private javax.swing.JMenuBar MainMenu;
|
private javax.swing.JMenuBar MainMenu;
|
||||||
private chart.Chart chart2;
|
|
||||||
private gui.ControlPanel controlPanel2;
|
private gui.ControlPanel controlPanel2;
|
||||||
|
private chart.FullChart fullChart2;
|
||||||
private javax.swing.JButton jButton1;
|
private javax.swing.JButton jButton1;
|
||||||
|
private javax.swing.JMenu jMenu1;
|
||||||
private javax.swing.JMenu jMenu2;
|
private javax.swing.JMenu jMenu2;
|
||||||
private javax.swing.JMenuItem jMenuItem1;
|
private javax.swing.JMenuItem jMenuItem1;
|
||||||
private javax.swing.JScrollPane jScrollPane1;
|
private javax.swing.JMenuItem jMenuItem2;
|
||||||
private gui.OrderBookPanel orderBookPanel1;
|
private gui.OrderBookPanel orderBookPanel1;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package sesim;
|
|||||||
public class BuyOrder extends Order implements Comparable<Order> {
|
public class BuyOrder extends Order implements Comparable<Order> {
|
||||||
|
|
||||||
public BuyOrder(){
|
public BuyOrder(){
|
||||||
type=OrderType.bid;
|
super(OrderType.bid);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -221,6 +221,10 @@ public class Exchange extends Thread {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param o
|
||||||
|
*/
|
||||||
public void cancelOrder(Order o) {
|
public void cancelOrder(Order o) {
|
||||||
tradelock.lock();
|
tradelock.lock();
|
||||||
TreeSet<Order> book = this.selectOrderBook(o.type);
|
TreeSet<Order> book = this.selectOrderBook(o.type);
|
||||||
@ -249,7 +253,100 @@ public class Exchange extends Thread {
|
|||||||
|
|
||||||
long nextQuoteId = 0;
|
long nextQuoteId = 0;
|
||||||
|
|
||||||
private void executeOrders() {
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected void executeOrders() {
|
||||||
|
|
||||||
|
while (!bid.isEmpty() && !ask.isEmpty()) {
|
||||||
|
|
||||||
|
Order b = bid.first();
|
||||||
|
Order a = ask.first();
|
||||||
|
|
||||||
|
if (b.limit < a.limit) {
|
||||||
|
// no match, nothing to do
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
double price = b.id < a.id ? b.limit : a.limit;
|
||||||
|
long volume = b.volume>=a.volume ? a.volume : b.volume;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (a.volume == 0) {
|
||||||
|
// This order is fully executed, remove
|
||||||
|
a.account.orderpending = false;
|
||||||
|
a.status = OrderStatus.executed;
|
||||||
|
|
||||||
|
a.account.pending.remove(a);
|
||||||
|
|
||||||
|
ask.pollFirst();
|
||||||
|
this.updateBookReceivers(OrderType.ask);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b.volume == 0) {
|
||||||
|
// This order is fully executed, remove
|
||||||
|
b.account.orderpending = false;
|
||||||
|
b.status = OrderStatus.executed;
|
||||||
|
b.account.pending.remove(b);
|
||||||
|
bid.pollFirst();
|
||||||
|
this.updateBookReceivers(OrderType.bid);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b.limit >= a.limit) {
|
||||||
|
|
||||||
|
price = b.id < a.id ? b.limit : a.limit;
|
||||||
|
|
||||||
|
/* if (b.id < a.id) {
|
||||||
|
price = b.limit;
|
||||||
|
} else {
|
||||||
|
price = a.limit;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
if (b.volume >= a.volume) {
|
||||||
|
volume = a.volume;
|
||||||
|
} else {
|
||||||
|
volume = b.volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
transferShares(a.account, b.account, volume, price);
|
||||||
|
|
||||||
|
// b.account.Buy(a.account, volume, price);
|
||||||
|
b.volume -= volume;
|
||||||
|
a.volume -= volume;
|
||||||
|
|
||||||
|
lastprice = price;
|
||||||
|
lastsvolume = volume;
|
||||||
|
|
||||||
|
Quote q = new Quote();
|
||||||
|
|
||||||
|
q.volume = volume;
|
||||||
|
q.price = price;
|
||||||
|
q.time = System.currentTimeMillis();
|
||||||
|
|
||||||
|
q.ask = a.limit;
|
||||||
|
q.bid = b.limit;
|
||||||
|
q.id = nextQuoteId++;
|
||||||
|
|
||||||
|
this.updateQuoteReceivers(q);
|
||||||
|
this.updateBookReceivers(OrderType.bid);
|
||||||
|
this.updateBookReceivers(OrderType.ask);
|
||||||
|
|
||||||
|
|
||||||
|
quoteHistory.add(q);
|
||||||
|
continue;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeOrdersX() {
|
||||||
|
|
||||||
while (!bid.isEmpty() && !ask.isEmpty()) {
|
while (!bid.isEmpty() && !ask.isEmpty()) {
|
||||||
|
|
||||||
@ -285,15 +382,15 @@ public class Exchange extends Thread {
|
|||||||
|
|
||||||
if (b.limit >= a.limit) {
|
if (b.limit >= a.limit) {
|
||||||
double price;
|
double price;
|
||||||
|
|
||||||
price = b.id<a.id ? b.limit : a.limit;
|
|
||||||
|
|
||||||
if (b.id < a.id) {
|
price = b.id < a.id ? b.limit : a.limit;
|
||||||
|
|
||||||
|
/* if (b.id < a.id) {
|
||||||
price = b.limit;
|
price = b.limit;
|
||||||
} else {
|
} else {
|
||||||
price = a.limit;
|
price = a.limit;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
long volume;
|
long volume;
|
||||||
|
|
||||||
if (b.volume >= a.volume) {
|
if (b.volume >= a.volume) {
|
||||||
|
@ -25,12 +25,13 @@ public abstract class Order implements Comparable<Order> {
|
|||||||
/**
|
/**
|
||||||
* Type of order
|
* Type of order
|
||||||
*/
|
*/
|
||||||
public OrderType type;
|
public final OrderType type;
|
||||||
|
|
||||||
public Account account = null;
|
public Account account = null;
|
||||||
|
|
||||||
|
|
||||||
protected int compareLimit(Order o){
|
protected int compareLimit(Order o){
|
||||||
|
|
||||||
int r=0;
|
int r=0;
|
||||||
if (o.limit < limit) {
|
if (o.limit < limit) {
|
||||||
r=-1;
|
r=-1;
|
||||||
@ -58,13 +59,7 @@ public abstract class Order implements Comparable<Order> {
|
|||||||
if (r!=0)
|
if (r!=0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
/* if (o.timestamp> timestamp)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (o.timestamp<timestamp)
|
|
||||||
return 1;
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (o.id>id)
|
if (o.id>id)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -104,7 +99,7 @@ public abstract class Order implements Comparable<Order> {
|
|||||||
return String.format("%d", volume);
|
return String.format("%d", volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
Order() {
|
Order(OrderType type) {
|
||||||
|
this.type=type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,6 @@ package sesim;
|
|||||||
public class SellOrder extends Order {
|
public class SellOrder extends Order {
|
||||||
|
|
||||||
public SellOrder(){
|
public SellOrder(){
|
||||||
type=OrderType.ask;
|
super(OrderType.ask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user