I'm trying to make a simle java program that draws a circle at the mouse localization, it gets the mouse X and Y coordinates but it doesn't draw anything, i tried to draw a String, a circle and a line but nothing worked, i changed the code a bit but it still doesn't works
class Test4 {
public static String a;
public static JFrame frame = new JFrame();
public static Point Gett(){
PointerInfo h = MouseInfo.getPointerInfo();
Point b = h.getLocation();
return b;
}
public void paintComponent(int x, int y, Graphics g) {
g.drawOval(x, y, 10, 10);
}
public static void main(String[] args) throws InterruptedException {
int h = 250;
int f = 200;
frame.setVisible(true);
frame.setSize(h, f);
frame.setLocationRelativeTo(null);
while(true){
Point b = Gett();
int x = (int) b.getX();
int y = (int) b.getY();
System.out.println(x);
System.out.println(y);
frame.repaint();}}}