diff --git a/nbproject/project.properties b/nbproject/project.properties index a8e7e1a..f1a8e7a 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,4 +1,4 @@ -#Sat, 30 Sep 2017 20:42:29 +0200 +#Sat, 30 Sep 2017 21:57:38 +0200 annotation.processing.enabled=true annotation.processing.enabled.in.editor=false annotation.processing.processors.list= diff --git a/src/chart/Chart1.java b/src/chart/Chart1.java index 1bbf378..08e8ea7 100644 --- a/src/chart/Chart1.java +++ b/src/chart/Chart1.java @@ -115,8 +115,11 @@ public class Chart1 extends javax.swing.JPanel implements QuoteReceiver, Adjustm this.xbar.setMaximum(994000); + ChartPainter p = new ChartPainter(); + p.drawChart((Graphics2D)g, xbar, getSize()); - drawChart((Graphics2D)g); + + //drawChart((Graphics2D)g); } /** @@ -148,7 +151,7 @@ public class Chart1 extends javax.swing.JPanel implements QuoteReceiver, Adjustm @Override public void adjustmentValueChanged(AdjustmentEvent e) { System.out.printf("Adjustemntlistener called %d\n",xbar.getValue()); - + this.repaint(); } diff --git a/src/chart/ChartPainter.java b/src/chart/ChartPainter.java index d04d994..e121d26 100644 --- a/src/chart/ChartPainter.java +++ b/src/chart/ChartPainter.java @@ -25,6 +25,8 @@ */ package chart; +import java.awt.Color; +import java.awt.Dimension; import java.awt.Graphics2D; import javax.swing.JScrollBar; @@ -36,16 +38,18 @@ public class ChartPainter { int em_width; - final void init(Graphics2D g) { + protected final void init(Graphics2D g) { // Calculate the number of pixels for 1 em em_width = g.getFontMetrics().stringWidth("M"); } - public void drawChart(Graphics2D g, JScrollBar sb) { + public void drawChart(Graphics2D g, JScrollBar sb, Dimension size) { init (g); - + g.setColor(Color.MAGENTA); + g.drawLine(0, 0, size.width, 100); + g.setBackground(Color.yellow); } diff --git a/src/chart/ChartTestDialog.form b/src/chart/ChartTestDialog.form index b8785a1..6b83bd1 100644 --- a/src/chart/ChartTestDialog.form +++ b/src/chart/ChartTestDialog.form @@ -44,10 +44,10 @@ - - - - + + + + @@ -70,7 +70,7 @@ - + diff --git a/src/chart/ChartTestDialog.java b/src/chart/ChartTestDialog.java index 6a2db89..b61e0c6 100644 --- a/src/chart/ChartTestDialog.java +++ b/src/chart/ChartTestDialog.java @@ -69,7 +69,7 @@ public class ChartTestDialog extends javax.swing.JDialog { ); chart11Layout.setVerticalGroup( chart11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 157, Short.MAX_VALUE) + .addGap(0, 198, Short.MAX_VALUE) ); jToolBar1.setFloatable(false); @@ -91,10 +91,10 @@ public class ChartTestDialog extends javax.swing.JDialog { layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() - .addComponent(chart11, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(53, 53, 53) - .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 89, Short.MAX_VALUE) + .addComponent(chart11, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) );