title: doClick() method of JButton
body: <p>doClick() method of JButton triggers actionPerformed Method, but I want to trigger paintComponent() by use of doClick() method! Please help! </p>
  
  <p>This is what is suggested? Here i have a label whose text is being changed every time a doClick() method's action is performed. But unfortunately, paintComponent method does not execute the same number of times as the actionPerformed() method. This is just the code what is suggested as Answer. I actually want to trigger doClick() method when data is being read from the file and diffrent shapes are painted according to data in the text file! </p>
  
  <pre><code>import javax.swing.*; 
  import java.awt.*; 
  import java.awt.event.*;
  public class myFrame {
  JFrame jFrame;
  myPanel bpanel;
  JButton jbutton;
  int radius;
  JLabel label; 
  public myFrame() {
      jFrame=new JFrame();
      bpanel=new myPanel();
      jbutton=new JButton("presss");
       radius=50; 
       label=new JLabel(radius+" "); 
       bpanel.add(jbutton); 
       bpanel.add(label);  
       jbutton.addActionListener(new myButtonListener());
       for (int i=0; i&lt; 5; i++)
           jbutton.doClick(); 
       jFrame.getContentPane().add(bpanel);
       jFrame.pack(); 
       jFrame.setVisible(true); 
   }
   public class myPanel extends JPanel {
        public myPanel() {
            setBackground(Color.cyan); 
            setPreferredSize(new Dimension(300,400)); 
        }
        public void paintComponent(Graphics g) {
          System.out.println("paint component triggered"); 
          super.paintComponent(g);
          g.drawOval(0,0,radius,radius); 
        }
   }
   private class myButtonListener implements ActionListener {
       public void actionPerformed(ActionEvent e) {
            radius=radius+20; 
            label.setText(radius+" ");
            bpanel.repaint(); 
            System.out.println("mouse click event triggered"); 
       }
   }
   public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
              @Override
              public void run() {
                  new myFrame();
              }
          }); 
   }
  </code></pre>
  
  <p>}</p>