Some improvemements

This commit is contained in:
7u83 2017-02-05 10:01:13 +01:00
parent 35563f19c3
commit 270cab34dc
6 changed files with 52 additions and 62 deletions

View File

@ -16,44 +16,38 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="844" max="32767" attributes="0"/>
<Component id="chart2" pref="617" max="32767" 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"/>
<Component id="jScrollPane1" pref="321" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="27" max="32767" attributes="0"/>
<Component id="chart2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Container class="chart.Chart" name="chart2">
<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="3480" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="280" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</SubComponents>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="617" 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>
</Container>
</SubComponents>
</Form>

View File

@ -411,7 +411,7 @@ public class FullChart extends javax.swing.JPanel {
public FullChart() {
initComponents();
Chart chart = new Chart();
this.jScrollPane1.setViewportView(chart);
// this.jScrollPane1.setViewportView(chart);
// this.jScrollPane1.setRowHeaderView(chart);
@ -427,43 +427,39 @@ public class FullChart extends javax.swing.JPanel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
chart1 = new chart.Chart();
chart2 = new chart.Chart();
javax.swing.GroupLayout chart1Layout = new javax.swing.GroupLayout(chart1);
chart1.setLayout(chart1Layout);
chart1Layout.setHorizontalGroup(
chart1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 3480, Short.MAX_VALUE)
javax.swing.GroupLayout chart2Layout = new javax.swing.GroupLayout(chart2);
chart2.setLayout(chart2Layout);
chart2Layout.setHorizontalGroup(
chart2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 617, Short.MAX_VALUE)
);
chart1Layout.setVerticalGroup(
chart1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 280, Short.MAX_VALUE)
chart2Layout.setVerticalGroup(
chart2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, 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()
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 844, Short.MAX_VALUE)
.addComponent(chart2, javax.swing.GroupLayout.DEFAULT_SIZE, 617, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(27, Short.MAX_VALUE)
.addComponent(chart2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.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.Chart chart2;
// End of variables declaration//GEN-END:variables
}

View File

@ -310,7 +310,7 @@
<EmptySpace max="32767" attributes="0"/>
<Component id="clock1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="17" max="-2" attributes="0"/>
<Component id="jSpinner2" min="-2" pref="90" max="-2" attributes="0"/>
<Component id="accelSpinner" min="-2" pref="90" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@ -322,7 +322,7 @@
<Component id="jButton1" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="jSpinner2" min="-2" max="-2" attributes="0"/>
<Component id="accelSpinner" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
@ -382,14 +382,14 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinner2">
<Component class="javax.swing.JSpinner" name="accelSpinner">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1.0" minimum="0.0" numberType="java.lang.Double" stepSize="100.0" type="number"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="jSpinner2StateChanged"/>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="accelSpinnerStateChanged"/>
</Events>
</Component>
<Component class="gui.Clock" name="clock1">

View File

@ -125,7 +125,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
jButton1 = new javax.swing.JButton();
jRunButton = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jSpinner2 = new javax.swing.JSpinner();
accelSpinner = new javax.swing.JSpinner();
clock1 = new gui.Clock();
menuBar = new javax.swing.JMenuBar();
fileMenu = new javax.swing.JMenu();
@ -211,10 +211,10 @@ public class NewMDIApplication extends javax.swing.JFrame {
}
});
jSpinner2.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.0d, null, 100.0d));
jSpinner2.addChangeListener(new javax.swing.event.ChangeListener() {
accelSpinner.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.0d, null, 100.0d));
accelSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
jSpinner2StateChanged(evt);
accelSpinnerStateChanged(evt);
}
});
@ -231,7 +231,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(clock1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(17, 17, 17)
.addComponent(jSpinner2, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(accelSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
@ -241,7 +241,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jSpinner2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(accelSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
@ -466,6 +466,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
void startSim(){
resetSim();
this.startTraders();
//Globals.se.timer.set
Globals.se.timer.start();
}
@ -583,10 +584,10 @@ startSim();
}//GEN-LAST:event_viewClockActionPerformed
private void jSpinner2StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSpinner2StateChanged
Double val = (Double)this.jSpinner2.getValue();
Globals.se.timer.setMultiply(val);
}//GEN-LAST:event_jSpinner2StateChanged
private void accelSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_accelSpinnerStateChanged
Double val = (Double)this.accelSpinner.getValue();
Globals.se.timer.setAcceleration(val);
}//GEN-LAST:event_accelSpinnerStateChanged
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
// TODO add your handling code here:
@ -667,6 +668,7 @@ startSim();
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenuItem aboutMenuItem;
private javax.swing.JSpinner accelSpinner;
private chart.Chart chart;
private gui.Clock clock1;
private javax.swing.JMenuItem contentMenuItem;
@ -690,7 +692,6 @@ startSim();
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JPopupMenu.Separator jSeparator1;
private javax.swing.JPopupMenu.Separator jSeparator2;
private javax.swing.JSpinner jSpinner2;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JMenuBar menuBar;
private javax.swing.JMenuItem openMenuItem;

View File

@ -125,7 +125,6 @@ public class TraderListPanel extends javax.swing.JPanel {
@Override
public void run() {
System.out.print("TTrunner\n");
model.update(this.newlist);
}

View File

@ -238,9 +238,9 @@ public class RandomTrader extends AutoTrader {
Action a = getAction();
switch (a) {
case BUY:
return doBuy();
return doBuy()+1;
case SELL:
return doSell();
return doSell()+1;
}
// System.out.printf("%s: do nothing\n",this.getName());