Please check out this code. Why does the compiler shows a cannot find symbol error(cannot find symbol- method setToolTiptext(java.lang.String))?
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
public class JavaToolTipExample extends JFrame
{
private Button b;
public JavaToolTipExample()
{
super("Tool Tip");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setLayout(null);
setVisible(true);
b=new Button("Hover on me!");
b.setToolTipText("Click!");
add(b);
event e=new event();
b.addActionListener(e);
}
public class event implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
b.setText("Clicked");
}
}
public static void main(String[]args)
{
JavaToolTipText gui=new JavaToolTipText();
}
}