Created
February 6, 2013 22:22
-
-
Save jnizet/4726452 to your computer and use it in GitHub Desktop.
Hiding button test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ButtonTest { | |
public static void main(String[] args) { | |
SwingUtilities.invokeLater(new Runnable() { | |
@Override | |
public void run() { | |
showGUI(); | |
} | |
} | |
); | |
} | |
private static void showGUI() { | |
JFrame f = new JFrame(); | |
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); | |
final JButton button = new JButton("test"); | |
button.addActionListener(new ActionListener() { | |
@Override | |
public void actionPerformed(ActionEvent e) { | |
button.setVisible(false); | |
} | |
}); | |
f.add(button); | |
f.pack(); | |
f.setVisible(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment