title: How to "disable a method" in java and make it active in an actionPerformed method if that makes any sense
body: <p>Situation: So I am calling the method draw from my paint method. However, I only want it to draw if the convert button is clicked. How do I tell java to not draw3Drectangle unless (ae.getSource==convert)?? I am new to GUI as you can probably tell, so simple answers please. Appreciate any help.</p>
  
  <p>CODE:</p>
  
  <pre><code>public class simpgui extends Applet implements ActionListener 
  { 
  
    Button convert;
  
    Label celsius;
  
    Label farenheit;
  
    TextField cels;
  
    TextField fare; 
  
    String message = "";
  
    public void init()
    {
  
      convert = new Button("Convert");
  
      celsius = new Label("Celsius");
  
      farenheit = new Label("Farenheit");
  
      cels = new TextField(15);
  
      fare = new TextField(15);
  
  
      add(convert);
  
      add(celsius);
  
      add(cels);
  
      add(farenheit);
  
      add(fare);
  
      convert.addActionListener(this);
  
    }
  
    public void paint(Graphics g)
    {
  
      fare.setLocation(160,50);
  
      farenheit.setLocation(90,50);
  
      convert.setLocation(310,5);
  
      draw(g);
  
    }
  
    public void actionPerformed (ActionEvent ae)
    {
  
      if(ae.getSource() == convert)
  
      {
  
          int farenheit = (int) ((Double.parseDouble(cels.getText())) * (1.8)) + 32;
  
  
          fare.setText(farenheit+"");
      }
  
    } 
  
    public static void draw(Graphics g)
    {
      g.setColor(Color.BLUE);
      g.fill3DRect(0,0,400,100,true);
    }
  }
  </code></pre>