-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMainWindow.java
More file actions
43 lines (36 loc) · 1015 Bytes
/
Copy pathMainWindow.java
File metadata and controls
43 lines (36 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import java.awt.FlowLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
public class MainWindow
{
public static void main(String[] args)
{
JButton button = new JButton("Click");
JCheckBox check = new JCheckBox("Test");
JFrame frame = new JFrame();
frame.setLocation(100, 200);
frame.setSize(400, 400);
frame.setLayout(new FlowLayout());
frame.add(button);
frame.add(check);
JPanel tab1 = new JPanel();
tab1.setSize(500,500);
JTabbedPane pane = new JTabbedPane();
pane.addTab("title", tab1);
frame.add(pane);
button.addActionListener(new ButtonListener());
button.addActionListener(new AnotherListener());
check.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
System.out.println("check box listener");
}
});
frame.setVisible(true);
}
}