Skip to content

Instantly share code, notes, and snippets.

@bitsmuggler
Created March 1, 2016 14:09
Show Gist options
  • Save bitsmuggler/e2a0bb1d99a10f94d7e8 to your computer and use it in GitHub Desktop.
Save bitsmuggler/e2a0bb1d99a10f94d7e8 to your computer and use it in GitHub Desktop.
HelloWorld Klasse für Java-Einstieg
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class HelloWorld {
private JButton buttonOK;
private JPanel panel1;
public HelloWorld() {
buttonOK.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(null, "Mein erstes Click-Event! :-)");
}
});
}
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setContentPane(new HelloWorld().panel1);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment