Witam, chciałbym napisać program za pomocą Java Swing, do którego będę wpisywać kolejne punkty, a po kliknięciu w przycisk 'Rysuj' narysuje on te punkty na układzie współrzędnych, brakuje mi tylko rysowania tych punktów.
Szukałem na internecie poradników i jedyne do czego doszedłem to taka funkcja:
import javax.swing.*;
import java.awt.*;
public class DrawPoints extends JFrame {
private int x;
private int y;
public DrawPoints() {
this.x = 0;
this.y = 0;
}
public DrawPoints(int x, int y, int weight, int height) throws HeadlessException {
this.x = x;
this.y = y;
}
public void paint(Graphics g, int x, int y) {
g.drawOval(500+(x*18), 195+(y*18), 5, 5);
}
}
Oraz część funkcji wywołującej (póki co tylko pierwsze) dane z tablic:
if (event.getActionCommand().equals("Rysuj")) {
DrawPoints drawPoints = new DrawPoints();
drawPoints.paint(null, daneX.get(0), daneY.get(0));
}
Po kliknięciu w przycisk 'Rysuj' nic się nie dzieje, co może być przyczyną?