0
//Gui with Frames and Layouts

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

public class Test extends JFrame {
    public Test() {
        super("TITLE");
        setLayout(new FlowLayout());

        item1 = new JLabel("This is a sentence.");
        item1.setToolTipText("This is gonna show on hover");
        add(item1);
    }
}

The upper class is the GUI class which on compiling produces error that couldn't find symbol item1?? How's it so?? I have declared it as JLabel. Please help

Juan Carlos Mendoza
  • 5,736
  • 7
  • 25
  • 50

0 Answers0