Hi I am trying to create parabolic curves using lines in awt java but previous lines are getting removed as soon as some new lines are drawn.
I am using this code in paint method
static int x1 = 0;
static int y1 = 300;
static int x2 = 300;
static int y2 = 300;
@Override
protected void paintComponent(Graphics g) {
//super.paintComponent(g);
g.setColor(Color.RED);
for(int i = 0; i < 15;i++,x1 += 4, y2 -= 2) {
g.drawLine(x2, y2, x1, y1);
}
//repaint();
}
but if i iterate loop for 10 times then only its drawing lines correctly.
what I want to acheive is draw parabolic curves in each quadrant like this
ignore the red text in second image. Ref - https://www.mrsmilewski.com/parabolic-curve.html Any help appreciated.