~ubuntu-branches/debian/stretch/insubstantial/stretch

« back to all changes in this revision

Viewing changes to substance-swingx/src/main/java/org/pushingpixels/substance/swingx/SubstancePanelUI.java

  • Committer: Package Import Robot
  • Author(s): Felix Natter
  • Date: 2016-01-18 20:58:45 UTC
  • Revision ID: package-import@ubuntu.com-20160118205845-crbmrkda61qsi5qa
Tags: upstream-7.3+dfsg2
ImportĀ upstreamĀ versionĀ 7.3+dfsg2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2005-2010 Kirill Grouchnikov, based on work by
 
3
 * Sun Microsystems, Inc. All rights reserved.
 
4
 *
 
5
 * This library is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU Lesser General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2.1 of the License, or (at your option) any later version.
 
9
 *
 
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.pushingpixels.substance.swingx;
 
20
 
 
21
import javax.swing.JComponent;
 
22
import javax.swing.plaf.ComponentUI;
 
23
 
 
24
import org.jdesktop.swingx.JXPanel;
 
25
import org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities;
 
26
 
 
27
/**
 
28
 * Substance-consistent UI delegate for {@link JXPanel}.
 
29
 * 
 
30
 * @author Kirill Grouchnikov
 
31
 */
 
32
public class SubstancePanelUI extends org.pushingpixels.substance.internal.ui.SubstancePanelUI {
 
33
 
 
34
        public static ComponentUI createUI(JComponent comp) {
 
35
                SubstanceCoreUtilities.testComponentCreationThreadingViolation(comp);
 
36
                return new SubstancePanelUI();
 
37
        }
 
38
 
 
39
        /*
 
40
         * (non-Javadoc)
 
41
         * 
 
42
         * @see
 
43
         * org.jvnet.substance.SubstancePanelUI#toPaintBackground(javax.swing.JComponent
 
44
         * )
 
45
         */
 
46
        @Override
 
47
        protected boolean toPaintBackground(JComponent c) {
 
48
                boolean result = super.toPaintBackground(c);
 
49
                if (c instanceof JXPanel) {
 
50
                        JXPanel jxPanel = (JXPanel) c;
 
51
                        if (jxPanel.getAlpha() < 1.0)
 
52
                                return true;
 
53
                }
 
54
                return result;
 
55
        }
 
56
 
 
57
}