mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-26 06:48:04 +02:00
27 lines
786 B
Java
27 lines
786 B
Java
public class test {
|
|
public static void main(String[] args) {
|
|
JFrame frame = new JFrame("My title!");
|
|
frame.setVisible(true);
|
|
frame.setSize(300, 150);
|
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
|
|
JPanel panel = new JPanel();
|
|
frame.add(panel);
|
|
|
|
JLabel label = new JLabel("my label");
|
|
panel.add(label);
|
|
|
|
JButton button = new JButton("my button");
|
|
panel.add(button);
|
|
button.addActionListener(new MyAction());
|
|
}
|
|
|
|
static class MyAction implements ActionListener {
|
|
@Override
|
|
public void actionPerformed(ActionEvent e) {
|
|
JFrame frame2 = new JFrame("clicked");
|
|
frame2.setVisible(true);
|
|
frame2.setSize(200,200);
|
|
}
|
|
}
|
|
}
|