some work

This commit is contained in:
7u83 2017-12-20 19:18:26 +01:00
parent 3c50dc80ca
commit 6780f78e14
2 changed files with 37 additions and 17 deletions

View File

@ -1,4 +1,4 @@
#Sat, 16 Dec 2017 19:44:00 +0100 #Wed, 20 Dec 2017 19:18:09 +0100
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=

View File

@ -29,6 +29,7 @@ import chart.painter.XLegendPainter;
import gui.Globals; import gui.Globals;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.border.Border; import javax.swing.border.Border;
@ -54,34 +55,38 @@ public class MMChart extends javax.swing.JPanel {
} }
JPanel xLegend; JPanel xLegend;
JPanel yLegend;
JPanel mainChart;
final void setupLayout() {
this.removeAll();
void setupLayout() {
Border redborder = javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)); Border redborder = javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0));
Border blueborder = javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 255)); Border blueborder = javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 255));
// jButton1 = new javax.swing.JButton();
// jToggleButton1 = new javax.swing.JToggleButton(); yLegend = new JPanel();
java.awt.GridBagLayout layout = new java.awt.GridBagLayout(); java.awt.GridBagLayout layout = new java.awt.GridBagLayout();
setLayout(layout); setLayout(layout);
java.awt.GridBagConstraints gridBagConstraints;
// jButton1.setText("jButton1");
JButton but = new JButton();
but.setText("Hello world");
JPanel p;
p = new JPanel(); java.awt.GridBagConstraints gridBagConstraints;
p.setBorder(redborder);
p.setBackground(Color.blue); yLegend.setBorder(redborder);
p.setPreferredSize(new Dimension(0,0)); yLegend.setPreferredSize(new Dimension(0,0));
gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0; gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0; gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0; gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0; gridBagConstraints.weighty = 1.0;
add(p, gridBagConstraints);
p = new JPanel(); add(yLegend, gridBagConstraints);
/* p = new JPanel();
p.setPreferredSize(new Dimension(100,40)); p.setPreferredSize(new Dimension(100,40));
p.setBorder(redborder); p.setBorder(redborder);
p.setBackground(Color.yellow); p.setBackground(Color.yellow);
@ -108,13 +113,28 @@ public class MMChart extends javax.swing.JPanel {
add(xLegend, gridBagConstraints); add(xLegend, gridBagConstraints);
*/
// p.setLayout(layout);
p.setLayout(layout);
} }
int em_width;
@Override
public void paint(Graphics g) {
em_width = g.getFontMetrics().stringWidth("M");
// this.removeAll();
// repaint();
setupLayout();
revalidate();
super.paint(g); //To change body of generated methods, choose Tools | Templates.
}
/** /**
* This method is called from within the constructor to initialize the form. * This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always * WARNING: Do NOT modify this code. The content of this method is always