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 org.jvnet.substance.swingx;
20:
21: import javax.swing.JButton;
22: import javax.swing.JComponent;
23: import javax.swing.plaf.ComponentUI;
24:
25: import org.jdesktop.swingx.JXDatePicker;
26: import org.jdesktop.swingx.plaf.basic.BasicDatePickerUI;
27: import org.jvnet.substance.SubstanceLookAndFeel;
28: import org.jvnet.substance.utils.SubstanceConstants.Side;
29:
30: /**
31: * Substance-consistent UI delegate for {@link JXDatePicker}.
32: *
33: * @author Kirill Grouchnikov
34: */
35: public class SubstanceDatePickerUI extends BasicDatePickerUI {
36: public static ComponentUI createUI(JComponent c) {
37: return new SubstanceDatePickerUI();
38: }
39:
40: /*
41: * (non-Javadoc)
42: *
43: * @see org.jdesktop.swingx.plaf.basic.BasicDatePickerUI#createPopupButton()
44: */
45: @Override
46: protected JButton createPopupButton() {
47: JButton result = super .createPopupButton();
48: result.setFocusPainted(false);
49: result.putClientProperty(
50: SubstanceLookAndFeel.BUTTON_SIDE_PROPERTY, Side.LEFT);
51: result.putClientProperty(
52: SubstanceLookAndFeel.BUTTON_OPEN_SIDE_PROPERTY,
53: Side.LEFT);
54: return result;
55: }
56: }
|