01: /*
02: * Copyright 2005-2008 Kirill Grouchnikov, based on work by
03: * Sun Microsystems, Inc. All rights reserved.
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18: */
19: package docrobot;
20:
21: import java.awt.BorderLayout;
22: import java.net.URL;
23:
24: import javax.swing.*;
25:
26: import org.jdesktop.swingx.JXHeader;
27: import org.jvnet.substance.SubstanceImageCreator;
28: import org.jvnet.substance.SubstanceLookAndFeel;
29: import org.jvnet.substance.skin.SubstanceBusinessBlackSteelLookAndFeel;
30:
31: public class HeaderFrame extends JFrame {
32: public HeaderFrame() {
33: super ("JXHeader example");
34:
35: this .setLayout(new BorderLayout());
36: ClassLoader cl = Thread.currentThread().getContextClassLoader();
37: URL iconUrl = cl
38: .getResource("docrobot/applications-internet.png");
39: Icon icon = new ImageIcon(iconUrl);
40: icon = new ImageIcon(SubstanceImageCreator.getThemeImage(null,
41: icon, SubstanceLookAndFeel.getTheme()
42: .getActiveTitlePaneTheme(), false));
43: String title = "LGPL license";
44: String description = "This library is free software; you can redistribute it and/or"
45: + " modify it under the terms of the GNU Lesser General Public"
46: + " License.";
47:
48: final JXHeader header = new JXHeader(title, description, icon);
49: this .add(header, BorderLayout.NORTH);
50:
51: this .setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
52: this .setSize(440, 300);
53: this .setLocationRelativeTo(null);
54: }
55:
56: public static void main(String[] args) throws Exception {
57: JFrame.setDefaultLookAndFeelDecorated(true);
58: UIManager
59: .setLookAndFeel(new SubstanceBusinessBlackSteelLookAndFeel());
60: // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
61: SwingUtilities.invokeLater(new Runnable() {
62: public void run() {
63: new HeaderFrame().setVisible(true);
64: }
65: });
66: }
67: }
|