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 test;
20:
21: import java.awt.FlowLayout;
22: import java.awt.event.ActionEvent;
23: import java.awt.event.ActionListener;
24:
25: import javax.swing.*;
26:
27: import org.jdesktop.swingx.JXDatePicker;
28: import org.jvnet.substance.SubstanceLookAndFeel;
29: import org.jvnet.substance.skin.SubstanceRavenLookAndFeel;
30:
31: public class MonthView extends JFrame {
32: public MonthView() {
33: this .setLayout(new FlowLayout());
34: final JXDatePicker datePicker = new JXDatePicker();
35: this .add(datePicker);
36:
37: JButton winLaf = new JButton("Windows");
38: winLaf.addActionListener(new ActionListener() {
39: public void actionPerformed(ActionEvent e) {
40: SwingUtilities.invokeLater(new Runnable() {
41: public void run() {
42: try {
43: UIManager
44: .setLookAndFeel(new SubstanceRavenLookAndFeel());
45: datePicker.getMonthView().updateUI();
46: SwingUtilities
47: .updateComponentTreeUI(MonthView.this );
48: } catch (Exception exc) {
49: }
50: }
51: });
52: }
53: });
54: this .add(winLaf);
55: this .pack();
56: this .setLocationRelativeTo(null);
57: this .setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
58: }
59:
60: public static void main(String[] args) throws Exception {
61: UIManager.setLookAndFeel(new SubstanceLookAndFeel());
62: SwingUtilities.invokeLater(new Runnable() {
63: public void run() {
64: new MonthView().setVisible(true);
65: }
66: });
67: }
68: }
|