1 | /**
|
---|
2 | *#########################################################################
|
---|
3 | *
|
---|
4 | * A component of the Gatherer application, part of the Greenstone digital
|
---|
5 | * library suite from the New Zealand Digital Library Project at the
|
---|
6 | * University of Waikato, New Zealand.
|
---|
7 | *
|
---|
8 | * Author: Chi-Yu Huang, Greenstone Digital Library, University of Waikato
|
---|
9 | *
|
---|
10 | * Copyright (C) 1999 New Zealand Digital Library Project
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or modify
|
---|
13 | * it under the terms of the GNU General Public License as published by
|
---|
14 | * the Free Software Foundation; either version 2 of the License, or
|
---|
15 | * (at your option) any later version.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful,
|
---|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
20 | * GNU General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, write to the Free Software
|
---|
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
25 | *########################################################################
|
---|
26 | */
|
---|
27 |
|
---|
28 | package org.greenstone.admin.gui;
|
---|
29 |
|
---|
30 |
|
---|
31 | import javax.swing.JTabbedPane;
|
---|
32 | import javax.swing.ImageIcon;
|
---|
33 | import javax.swing.JLabel;
|
---|
34 | import javax.swing.JPanel;
|
---|
35 | import javax.swing.JFrame;
|
---|
36 | import javax.swing.JComponent;
|
---|
37 | import java.awt.*;
|
---|
38 | import java.awt.event.KeyEvent;
|
---|
39 |
|
---|
40 | public class TabbedPane extends JPanel {
|
---|
41 |
|
---|
42 | private static final Dimension SIZE = new Dimension(800, 540);
|
---|
43 |
|
---|
44 | public TabbedPane() {
|
---|
45 | super(new GridLayout(1, 1));
|
---|
46 | setBackground(new Color(176,208,176));
|
---|
47 |
|
---|
48 | JTabbedPane tabbedPane = new JTabbedPane();
|
---|
49 | JComponent panel1 = makeTextPanel("Log information Pane");
|
---|
50 | /* tabbedPane.addTab("Log Pane", icon, panel1,
|
---|
51 | "Log Pane");*/
|
---|
52 | panel1.setPreferredSize(SIZE);
|
---|
53 | panel1.setBackground(new Color(176,208,176));
|
---|
54 | tabbedPane.addTab("Log Pane", panel1);
|
---|
55 | tabbedPane.setMnemonicAt(0, KeyEvent.VK_L);
|
---|
56 |
|
---|
57 |
|
---|
58 | JComponent panel2 = makeTextPanel("Runtime Status");
|
---|
59 | /*tabbedPane.addTab("Status Pane", icon, panel2,
|
---|
60 | "Status Pane");*/
|
---|
61 |
|
---|
62 | panel2.setPreferredSize(SIZE);
|
---|
63 | panel2.setBackground(new Color(176,208,176));
|
---|
64 | tabbedPane.addTab("Status Pane", panel2);
|
---|
65 | tabbedPane.setMnemonicAt(1, KeyEvent.VK_R);
|
---|
66 |
|
---|
67 | //Add the tabbed pane to this panel.
|
---|
68 | add(tabbedPane);
|
---|
69 | }
|
---|
70 |
|
---|
71 | protected JComponent makeTextPanel(String text) {
|
---|
72 | JPanel panel = new JPanel(false);
|
---|
73 | JLabel filler = new JLabel(text);
|
---|
74 | filler.setHorizontalAlignment(JLabel.CENTER);
|
---|
75 | panel.setLayout(new GridLayout(1, 1));
|
---|
76 | panel.add(filler);
|
---|
77 | return panel;
|
---|
78 | }
|
---|
79 |
|
---|
80 | /** Returns an ImageIcon, or null if the path was invalid. */
|
---|
81 | protected static ImageIcon createImageIcon(String path) {
|
---|
82 | java.net.URL imgURL = TabbedPane.class.getResource(path);
|
---|
83 | if (imgURL != null) {
|
---|
84 | return new ImageIcon(imgURL);
|
---|
85 | } else {
|
---|
86 | System.err.println("Couldn't find file: " + path);
|
---|
87 | return null;
|
---|
88 | }
|
---|
89 | }
|
---|
90 | }
|
---|