how do you resolve JLabel?

时间:2017-03-30 18:36:23

标签: java

When I tried to compile my code it said that JLabel can't be resolved and I'm not sure why since it works for me in the past.

here's my code so far:

import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.JLabel;


  public class build extends JFrame
  {
    private JLabel item1;
    public build(){
      super("coin flip");
      setLayout(new FlowLayout());

      item1 = new JLabel("This is coin flip game");
      item1.setToolTipText("Hover");
      add(item1);
    }
  }

1 个答案:

答案 0 :(得分:1)

import javax.JLabel;

应该是:

import javax.swing.JLabel;