Skip to content

Instantly share code, notes, and snippets.

@jnizet
Created February 6, 2013 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnizet/4726452 to your computer and use it in GitHub Desktop.
Save jnizet/4726452 to your computer and use it in GitHub Desktop.
Hiding button test
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