title: Warning: static method should be accessed in a static way
body: <p>I am learning Java and I am planning to create a calculator Java applet which has the function of adding, dividing, multiplying and reset. Got some warning sign that:</p>
  
  <blockquote>
    <p>The static method valueOf(double) from the type String should be accessed in a static way</p>
  </blockquote>
  
  <p>The calculator is working though. But kindly seek your expertise on how this warning sign could be avoided and what improvement i could made to the coding.</p>
  
  <p>CalEngine class which include listener, maths function.</p>
  
  <pre><code>public class CalEngine implements ActionListener{
  
      Calculator parent;
      double current=0;
      double prevnum=0;
      double totalnum=0;
      int funct=0;
      String equalnum;
      public CalEngine(Calculator parent) {
          this.parent = parent;
      }
  
  
      public void actionPerformed(ActionEvent e) {
  
      JButton src = (JButton) e.getSource();
      String  cbuttonlabel = src.getText();
      if(cbuttonlabel.equals("+"))
          {       clearscreen();
                  funct = 1;      }
      else if(cbuttonlabel.equals("-"))
      {       clearscreen();
              funct = 2;          }
      else if(cbuttonlabel.equals("/"))
      {       clearscreen();
              funct = 3;          }
      else if(cbuttonlabel.equals("="))
      {   equal();                }
      else if(cbuttonlabel.equals("Reset"))
      {   prevnum = 0;
          current = 0;
          totalnum =0;
          clearscreen();
      }
      else
          {
          prevnum = current;
          current = Double.parseDouble(cbuttonlabel);
          parent.setScreen(cbuttonlabel);
          }
      }
  
      private void equal() {
          if(funct == 1)
          {
              add();
          }
          else if(funct == 2)
          {
              minus();
          }
          else if(funct == 3)
          {
              divide();
          }
          parent.setScreen(equalnum.valueOf(totalnum));
          totalnum =0;
      }
  
      private void minus() {
          totalnum = prevnum-current;}
  
      private void divide() {
          totalnum = prevnum/current; }
  
      private void clearscreen() {
          parent.setScreen("");   }
  
      private void add() {
          totalnum = current + prevnum;
      }
  
  }
  
  
  
  Calculator UI
  
  public class Calculator {
  
      JPanel ova;
      JPanel pan;
      JTextField screen;
      JButton b1;
      JButton b2;
      JButton b3;
      JButton b4;
      JButton b5;
      JButton b6;
      JButton b7;
      JButton b8;
      JButton b9;
      JButton b0;
      JButton bplus;
      JButton bequal;
      JButton bminus;
      JButton bdivide;
      JButton breset;
  
      Calculator(){
  
          ova = new JPanel();
          BorderLayout bl = new BorderLayout(); 
          ova.setLayout(bl);
  
          screen = new JTextField(300);
          ova.add("North",screen);
  
          b1 = new JButton("1");
          b2 = new JButton("2");
          b3 = new JButton("3");
          b4 = new JButton("4");
          b5 = new JButton("5");
          b6 = new JButton("6");
          b7 = new JButton("7");
          b8 = new JButton("8");
          b9 = new JButton("9");
          b0 = new JButton("0");
          bplus = new JButton("+");
          bequal = new JButton("=");
          bminus = new JButton("-");
          bdivide = new JButton("/");
          breset = new JButton("Reset");
  
          pan = new JPanel();
          GridLayout gl = new GridLayout(5,3);
          pan.setLayout(gl);
  
          pan.add(b1);
          pan.add(b2);
          pan.add(b3);
          pan.add(b4);
          pan.add(b5);
          pan.add(b6);
          pan.add(b7);
          pan.add(b8);
          pan.add(b9);
          pan.add(b0);
          pan.add(bplus);
          pan.add(bequal);
          pan.add(bminus);
          pan.add(bdivide);
          pan.add(breset);        
  
          ova.add("Center",pan);
  
          JFrame jf = new JFrame("Calculator");
  
          jf.setContentPane(ova);
          jf.setVisible(true);
          jf.setSize(500,500);
  
          CalEngine calcEngine = new CalEngine(this);
          b0.addActionListener(calcEngine);
          b1.addActionListener(calcEngine);
          b2.addActionListener(calcEngine);
          b3.addActionListener(calcEngine);
          b4.addActionListener(calcEngine);
          b5.addActionListener(calcEngine);
          b6.addActionListener(calcEngine);
          b7.addActionListener(calcEngine);
          b8.addActionListener(calcEngine);
          b9.addActionListener(calcEngine);
          bplus.addActionListener(calcEngine);
          bequal.addActionListener(calcEngine);
          bminus.addActionListener(calcEngine);
          bdivide.addActionListener(calcEngine);
          breset.addActionListener(calcEngine);
      }
  
  
      public static void main(String[] args)
      {
          new Calculator();
  
      }
  
  
      public void setScreen(String wee) {
  
          screen.setText(wee);
      }
  
      public String getScreen() {
  
          return screen.getText();
      }
  }
  </code></pre>