From 608fba25309214966be6dc8e3e0ae25ce3036760 Mon Sep 17 00:00:00 2001 From: 7u83 <7u83@maiol.ru> Date: Sun, 26 Mar 2017 21:36:53 +0200 Subject: [PATCH] runs now on windows --- nbproject/project.properties | 2 +- src/chart/Chart.form | 1 + src/chart/Chart.java | 42 ++++++++++++++++++++++++++++++--- src/gui/EditAutoTraderList.java | 3 +++ src/gui/NewMDIApplication.java | 12 +++++++--- 5 files changed, 53 insertions(+), 7 deletions(-) diff --git a/nbproject/project.properties b/nbproject/project.properties index 5be4eab..0e4e9cd 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,4 +1,4 @@ -#Sun, 26 Mar 2017 14:28:26 +0100 +#Sun, 26 Mar 2017 21:28:05 +0100 annotation.processing.enabled=true annotation.processing.enabled.in.editor=false annotation.processing.processors.list= diff --git a/src/chart/Chart.form b/src/chart/Chart.form index 687aa69..9d83dad 100644 --- a/src/chart/Chart.form +++ b/src/chart/Chart.form @@ -40,6 +40,7 @@ + diff --git a/src/chart/Chart.java b/src/chart/Chart.java index 4fd34f9..6aa7253 100644 --- a/src/chart/Chart.java +++ b/src/chart/Chart.java @@ -503,6 +503,8 @@ System.out.printf("v1 %f, v2 %f\n",v1,v2); return; } + num_bars = data.size(); + c_mm = data.getMinMax(first_bar, last_bar); if (c_mm == null) { return; @@ -603,6 +605,9 @@ System.out.printf("v1 %f, v2 %f\n",v1,v2); if (Globals.se==null){ return; } + + + super.paintComponent(g); // Calculate the number of pixels for 1 em @@ -620,7 +625,9 @@ System.out.printf("v1 %f, v2 %f\n",v1,v2); first_bar = (int) (clip_bounds.x / (this.x_unit_width * this.em_size)); last_bar = 1 + (int) ((clip_bounds.x + clip_bounds.width - (this.y_legend_width * em_size)) / (this.x_unit_width * this.em_size)); - num_bars = data.size(); // + (int) (clip_bounds.width / (this.x_unit_width * this.em_size))+5; +// num_bars = data.size(); // + (int) (clip_bounds.width / (this.x_unit_width * this.em_size))+5; + +// num_bars=1; c_font_height = g.getFontMetrics().getHeight(); @@ -663,6 +670,9 @@ System.out.printf("v1 %f, v2 %f\n",v1,v2); public void mousePressed(java.awt.event.MouseEvent evt) { formMousePressed(evt); } + public void mouseReleased(java.awt.event.MouseEvent evt) { + formMouseReleased(evt); + } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); @@ -678,9 +688,14 @@ System.out.printf("v1 %f, v2 %f\n",v1,v2); }// //GEN-END:initComponents private void formMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMousePressed - if (!evt.isPopupTrigger()) { + System.out.printf("There was a mosue event\n"); + + + + if (!evt.isPopupTrigger() || true) { + System.out.printf("But there was no pupe trigger\n"); return; - }; + } // this.invalidate(); this.ctxMenu.setVisible(true); @@ -708,6 +723,27 @@ System.out.printf("v1 %f, v2 %f\n",v1,v2); this.repaint(); }//GEN-LAST:event_formMouseWheelMoved + private void formMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseReleased + + System.out.printf("There was a mosue event released\n"); + + + + if (!evt.isPopupTrigger()) { + System.out.printf("But there was no pupe trigger\n"); + return; + } + + // this.invalidate(); + this.ctxMenu.setVisible(true); + this.ctxMenu.show(this, evt.getX(), evt.getY()); + + this.invalidate(); + this.repaint(); + + + }//GEN-LAST:event_formMouseReleased + void setCompression(int timeFrame) { javax.swing.SwingUtilities.invokeLater(() -> { data = Globals.se.getOHLCdata(timeFrame); diff --git a/src/gui/EditAutoTraderList.java b/src/gui/EditAutoTraderList.java index 4f6e3e5..ef389d5 100644 --- a/src/gui/EditAutoTraderList.java +++ b/src/gui/EditAutoTraderList.java @@ -139,6 +139,9 @@ public class EditAutoTraderList extends javax.swing.JPanel { for (int r = 0; r < model.getRowCount(); r++) { Boolean e = (Boolean) list.getValueAt(r, list.getColumn("Enabled").getModelIndex()); + if (e==null){ + continue; + } if (!e) { continue; } diff --git a/src/gui/NewMDIApplication.java b/src/gui/NewMDIApplication.java index 3023185..69f902a 100644 --- a/src/gui/NewMDIApplication.java +++ b/src/gui/NewMDIApplication.java @@ -62,9 +62,10 @@ public class NewMDIApplication extends javax.swing.JFrame { */ public NewMDIApplication() { initComponents(); - Globals.frame = this; - this.setLocationRelativeTo(this); - this.setTitle("SeSim - Stock Exchange Simmulator"); +// Globals.frame = this; + // this.setLocationRelativeTo(this); + System.out.printf("Set title\n"); + setTitle("SeSim - Stock Exchange Simmulator"); } AutoTraderInterface createTraderNew(Exchange se, long id, String name, double money, double shares, JSONObject cfg) { @@ -738,6 +739,8 @@ public class NewMDIApplication extends javax.swing.JFrame { */ public static void main(String args[]) throws IllegalAccessException, InstantiationException { + System.out.printf("Main called\n"); + Globals.initGlobals(); //System.exit(0); Globals.se = new Exchange(); @@ -750,11 +753,14 @@ public class NewMDIApplication extends javax.swing.JFrame { java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { + System.out.printf("In run method now\n"); + String x = new java.io.File(NewMDIApplication.class.getProtectionDomain() .getCodeSource() .getLocation() .getPath()).toString(); //.getName(); + System.out.printf("Creating Application\n"); new NewMDIApplication().setVisible(true); } });