I have a problem, I want to put a graph that I did in a jframe in a jpanel inside that jframe. I'm working in Netbeans. Can someone solve it? The graphic I did was importing this class to draw a perlin noise function: link
For the graphic use this, first within my frame, and now I want to move it to the jpanel that it will have inside:
Noisy noisy = new Noisy((int) (100000 * Math.random()), 3);
public void paint(Graphics g) {
int y1, y2 = 0, x1, x2 = 0;
float rugosidad = 0.1f;
for (int i = 0; i < (500 * rugosidad); i++) {
y1 = (int) (100 * (noisy.perlinNoise((float) i / 10) + 1));
x1 = (int) (i / rugosidad);
g.setColor(Color.red);
g.drawLine(x1, y1, x2, y2);
y2 = y1;
x2 = x1;
}
}
Please, I need your help.