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.JComponent;
22: import javax.swing.plaf.ComponentUI;
23:
24: import org.jdesktop.swingx.JXPanel;
25:
26: /**
27: * Substance-consistent UI delegate for {@link JXPanel}.
28: *
29: * @author Kirill Grouchnikov
30: */
31: public class SubstancePanelUI extends
32: org.jvnet.substance.SubstancePanelUI {
33:
34: public static ComponentUI createUI(JComponent c) {
35: return new SubstancePanelUI();
36: }
37:
38: /*
39: * (non-Javadoc)
40: *
41: * @see org.jvnet.substance.SubstancePanelUI#toPaintBackground(javax.swing.JComponent)
42: */
43: @Override
44: protected boolean toPaintBackground(JComponent c) {
45: boolean result = super .toPaintBackground(c);
46: if (c instanceof JXPanel) {
47: JXPanel jxPanel = (JXPanel) c;
48: if (jxPanel.getAlpha() < 1.0)
49: return true;
50: }
51: return result;
52: }
53:
54: }
|