-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJTPDemo.java
58 lines (52 loc) · 1.25 KB
/
JTPDemo.java
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Demonstration of JTabbed Pane
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.applet.*;
/* <applet code = "JTPDemo" width = 100 height = 100> </applet> */
public class JTPDemo extends JApplet
{
public void init()
{
JTabbedPane jtp = new JTabbedPane();
jtp.addTab("Cities",new CitiesPanel());
jtp.addTab("Colors",new ColorsPane());
jtp.addTab("Flavors",new FlavorsPanel());
getContentPane.add(jtf);
}
}
class CitiesPanel extends JApplet
{
public CitiesPanel()
{
JButton jb1 = new JButton("New York");
add(jb1);
JButton jb2= new JButton("London");
add(jb2);
JButton jb1 = new JButton("Tokyo");
add(jb3);
}
}
public class ColorsPanel extends JApplet
{
public ColorsPanel()
{
JCheckbox cb1 = new JCheckbox("Red");
add(cb1);
JCheckbox cb2= new JCheckbox("Green");
add(cb2);
JCheckbox cb3= new JCheckbox("Blue");
add(cb3);
}
}
public class FlavorsPanel extends JApplet
{
public FlavorsPanel()
{
JComboBox jcb = new JComboBox();
jcb.addItem("Vannilla");
jcb.addItem("Strawberry");
jcb.addItem("Chocolate");
add(jcb);
}
}