forked from patniemeyer/learningjava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTabbedPaneFrame.java
More file actions
32 lines (27 loc) · 957 Bytes
/
Copy pathTabbedPaneFrame.java
File metadata and controls
32 lines (27 loc) · 957 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
//file: TabbedPaneFrame.java
import javax.swing.*;
public class TabbedPaneFrame {
public static void main(String[] args)
{
JFrame frame = new JFrame("TabbedPaneFrame");
JTabbedPane tabby = new JTabbedPane();
// create the controls pane
JPanel controls = new JPanel( );
controls.add(new JLabel("Service:"));
JList list = new JList(
new String[] { "Web server", "FTP server" });
list.setBorder(BorderFactory.createEtchedBorder( ));
controls.add(list);
controls.add(new JButton("Start"));
// create an image pane
String filename = "Piazza di Spagna.jpg";
JLabel image = new JLabel( new ImageIcon(filename) );
JComponent picture = new JScrollPane(image);
tabby.addTab("Controls", controls);
tabby.addTab("Picture", picture);
frame.getContentPane().add(tabby);
frame.setSize(200, 200);
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setVisible(true);
}
}