I am currently creating a program and I am trying to make a JLabel come onto the JFrame after it is cleared from "Yes" being pressed on a JOptionPane. Currently, I have not been able to get it to work.`ready = new JLabel("Are you ready?"); ready.setToolTipText("Are you ready to begin?");
}
private class thehandler implements ActionListener {
public void actionPerformed(ActionEvent event) {
String string = "";
Object[] options1 = {"Yes","No"};
if (event.getSource()==pname) {
string=String.format("You entered the name, %s, is this correct?", event.getActionCommand());
int n = JOptionPane.showOptionDialog(null, string, "Is this name correct?", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, options1, null);
if (n == JOptionPane.YES_OPTION) {
getContentPane().removeAll();
revalidate();
repaint();
add(credits);
add(ready);
}`
To prevent confusion, there is more code above which basically declares private JLabel ready in public class window extends JFrame.