work on charts
This commit is contained in:
parent
a1774aeded
commit
254846c356
@ -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=true
|
||||||
annotation.processing.enabled.in.editor=false
|
annotation.processing.enabled.in.editor=false
|
||||||
annotation.processing.processors.list=
|
annotation.processing.processors.list=
|
||||||
|
@ -115,8 +115,11 @@ public class Chart1 extends javax.swing.JPanel implements QuoteReceiver, Adjustm
|
|||||||
|
|
||||||
this.xbar.setMaximum(994000);
|
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
|
@Override
|
||||||
public void adjustmentValueChanged(AdjustmentEvent e) {
|
public void adjustmentValueChanged(AdjustmentEvent e) {
|
||||||
System.out.printf("Adjustemntlistener called %d\n",xbar.getValue());
|
System.out.printf("Adjustemntlistener called %d\n",xbar.getValue());
|
||||||
|
this.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
*/
|
*/
|
||||||
package chart;
|
package chart;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import javax.swing.JScrollBar;
|
import javax.swing.JScrollBar;
|
||||||
|
|
||||||
@ -36,16 +38,18 @@ public class ChartPainter {
|
|||||||
|
|
||||||
int em_width;
|
int em_width;
|
||||||
|
|
||||||
final void init(Graphics2D g) {
|
protected final void init(Graphics2D g) {
|
||||||
|
|
||||||
// Calculate the number of pixels for 1 em
|
// Calculate the number of pixels for 1 em
|
||||||
em_width = g.getFontMetrics().stringWidth("M");
|
em_width = g.getFontMetrics().stringWidth("M");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawChart(Graphics2D g, JScrollBar sb) {
|
public void drawChart(Graphics2D g, JScrollBar sb, Dimension size) {
|
||||||
init (g);
|
init (g);
|
||||||
|
g.setColor(Color.MAGENTA);
|
||||||
|
g.drawLine(0, 0, size.width, 100);
|
||||||
|
g.setBackground(Color.yellow);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,10 +44,10 @@
|
|||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<Group type="102" alignment="1" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="chart11" min="-2" pref="157" max="-2" attributes="0"/>
|
<Component id="chart11" min="-2" pref="198" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="-2" pref="53" max="-2" attributes="0"/>
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
<Component id="jToolBar1" min="-2" pref="25" max="-2" attributes="0"/>
|
<Component id="jToolBar1" pref="102" max="32767" attributes="0"/>
|
||||||
<EmptySpace pref="89" max="32767" attributes="0"/>
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
<Component id="jScrollBar1" min="-2" max="-2" attributes="0"/>
|
<Component id="jScrollBar1" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
@ -70,7 +70,7 @@
|
|||||||
</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="157" max="32767" attributes="0"/>
|
<EmptySpace min="0" pref="198" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
@ -69,7 +69,7 @@ public class ChartTestDialog extends javax.swing.JDialog {
|
|||||||
);
|
);
|
||||||
chart11Layout.setVerticalGroup(
|
chart11Layout.setVerticalGroup(
|
||||||
chart11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
chart11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGap(0, 157, Short.MAX_VALUE)
|
.addGap(0, 198, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
|
|
||||||
jToolBar1.setFloatable(false);
|
jToolBar1.setFloatable(false);
|
||||||
@ -91,10 +91,10 @@ public class ChartTestDialog extends javax.swing.JDialog {
|
|||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(chart11, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(chart11, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(53, 53, 53)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 89, 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)
|
.addComponent(jScrollBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user