paint and repaint problem
Hallo,
I use Netbeans 6.5 and just to make simple, I made a GUI with Netbeans GUI Builder.
Say that I have made a JFrame with a JPanel. And I want to draw the graph in this JPanel.
In JPanel "ProfilPanelLinks" I have add this methode:
Code:
private void gambar(Graphics g){
ProfilPanelLinks.add(dataModel);
dataModel.doDraw(g);
ProfilPanelLinks.repaint();
}
and the class for another is:
Code:
public class EvaluateDataModel {
private EvaluateDrawing draw;
protected EvaluateDataModel(){
draw = new EvaluateDrawing();
}
public void doDraw(Graphics g)
{
draw.draw(g);
}
}
Code:
public class EvaluateDrawing extends JPanel {
public void draw(Graphics g)
{
Graphics2D g2d = (Graphics2D)g;
super.paint(g2d);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setStroke(new BasicStroke(1));
g2d.setColor(Color.blue);
g2d.drawLine(0, 0, 100, 100);
}
}
There are 2 classes, yes, since this is just a cut from a long class. I need to paint at least 6 more graph from another ArrayList. But it won´t draw just a simple line.
Can anyone help me, how can I draw it with netbeans panel?
Thank you very much.