Hi I have a JButton that I want to program so that when pressed, a new JLabel is displayed on screen. I have added the JLabel to the frame and it is visible. It shows outside of actionPerformed but not inside it.
The label is declared as lbl outside the method and then it is created in the actionPerformed method
public void actionPerformed(ActionEvent e) {
JLabel lbl = new JLabel("ONE");
}
Can anybody help me to make the label appear when the button is pressed? Thanks