setupLayout not called in draw context anymore

This commit is contained in:
7u83 2017-12-28 09:00:17 +01:00
parent 05d3fe3861
commit 84b7cb3c5d
1 changed files with 12 additions and 3 deletions

View File

@ -56,6 +56,7 @@ public class MMChart extends javax.swing.JPanel {
public MMChart() { public MMChart() {
stock = Globals.se.getDefaultStock(); stock = Globals.se.getDefaultStock();
initComponents(); initComponents();
this.em_width=10;
setupLayout(); setupLayout();
} }
@ -115,6 +116,7 @@ public class MMChart extends javax.swing.JPanel {
private void setupMainChart() { private void setupMainChart() {
mainChart = new ChartPanel(); mainChart = new ChartPanel();
mainChart.setDoubleBuffered(true);
mainChart.setBackground(Color.green); mainChart.setBackground(Color.green);
GridBagConstraints gbConstraints; GridBagConstraints gbConstraints;
@ -129,6 +131,8 @@ public class MMChart extends javax.swing.JPanel {
} }
ChartDef chartDef; ChartDef chartDef;
@ -142,12 +146,14 @@ public class MMChart extends javax.swing.JPanel {
GridBagLayout layout = new GridBagLayout(); GridBagLayout layout = new GridBagLayout();
setLayout(layout); setLayout(layout);
chartDef = new ChartDef();
chartDef.x_unit_width = 3.0;
setupYLegend(); setupYLegend();
setupXLegend(); setupXLegend();
setupMainChart(); setupMainChart();
chartDef = new ChartDef();
chartDef.x_unit_width = 3.0;
java.awt.GridBagConstraints gbConstraints; java.awt.GridBagConstraints gbConstraints;
@ -164,7 +170,10 @@ public class MMChart extends javax.swing.JPanel {
// this.removeAll(); // this.removeAll();
// repaint(); // repaint();
setupLayout(); // setupLayout();
xLegend.setPreferredSize(new Dimension(em_width * 2, em_width * 3));
xLegend.setMinimumSize(new Dimension(em_width * 2, em_width * 3));
revalidate(); revalidate();
super.paint(g); //To change body of generated methods, choose Tools | Templates. super.paint(g); //To change body of generated methods, choose Tools | Templates.
} }