i am developing java application, i have a panel inside a form :  i want to get two parameters[a,b] in [setpoints] function from the form and use it in paintcomponent to draw with.but the problem is that two variables is no accessible  by the whole panel.it is only accessible  by [setpoints] function

Here is the code of the panel:

public class shape extends javax.swing.JPanel  {

   public int a;
    public int b;
    
    public shape() {
        initComponents();
           
    }
    public void setpoints(int x0,int y0)
    {
        this.a=x0;
        this.b=y0;
       
    }
  
    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
       
       g.setColor(Color.blue); 
        g.drawLine(a, b, a,b);
        
    }
}
       