1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
public class BAGraph extends JPanel{
JComponent _parent;
PositionScrollPanel _positions;
PhaseScrollPanel _phases;
BAGraphPan _graph;
private static final long serialVersionUID = 34L;
BestAlignementParamSet _param;
BAGraph( BestAlignementParamSet param, BestAlignement parent)
//BAGraph(ArrayList list, boolean circular , BestAlignement parent, float phase, float error)
{
super();
this.setLayout(null);
this.setBackground(Color.BLACK);
_param = param;
_parent = parent;
_positions = new PositionScrollPanel(_param, this);
this.add(_positions);
_phases = new PhaseScrollPanel(_param, this);
this.add(_phases);
_graph= new BAGraphPan(_param, parent, _positions, _phases);
this.add(_graph);
this.setBorder(BorderFactory.createLineBorder(Color.pink));
//this.setBounds(0,0 , _parent.getWidth(), _parent.getHeight());
this.setPreferredSize(new Dimension(_parent.getWidth(),_parent.getHeight()/3));
//this.setSize(new Dimension(_parent.getWidth(),_parent.getHeight()/3));
//_phases.setBounds(0, 0, 30, this.getHeight()-30);
//_graph.setBounds(30, 0, this.getWidth()-30, this.getHeight()-30);
//_positions.setBounds(30, this.getHeight()-30, this.getWidth()-30, 30);
}
/**BAGraph( ParamSet param, BestAlignement parent)
{
super();
_parent = parent;
_positions = new PositionScrollPanel(parent.getParam().getStartPos(), parent.getParam().getEndPos(), parent.getParam().getPeriod(), this);
this.add(_positions);
_phases = new PhaseScrollPanel(phase, this);
this.add(_phases);
_graph= new BAGraphPan(_positions, _phases, list, parent, phase, error);
this.add(_graph);
//this.setBounds(0,0 , _parent.getWidth(), _parent.getHeight());
//this.setPreferredSize(new Dimension(_parent.getWidth(),200));
_phases.setBounds(0, 0, 30, this.getHeight()-30);
_graph.setBounds(30, 0, this.getWidth()-30, this.getHeight()-30);
_positions.setBounds(30, this.getHeight()-30, this.getWidth()-30, 30);
}*/
public void updateDrawGraph()
{
_graph.repaint();
}
public void paintComponent(Graphics g)
{
super.paintComponent(g);
this.setPreferredSize(new Dimension(_parent.getWidth(),_parent.getHeight()/3));
this.setMaximumSize(new Dimension(_parent.getWidth(),_parent.getHeight()/3));
///this.setSize(new Dimension(_parent.getWidth(),_parent.getHeight()/3));
System.out.println("MEEEE "+this.getSize()+ " "+ _parent.getHeight()/3);
g.clearRect(0, 0, this.getWidth(),this.getHeight());
// _phases.setBounds(0, 0, 30, this.getHeight()-30);
// _graph.setBounds(30, 0, this.getWidth()-30, this.getHeight()-30);
// _positions.setBounds(30, this.getHeight()-30, this.getWidth()-30, 30);
System.out.println("MEEEE "+this.getSize());
}
} |