author | darcy |
Wed, 02 Jul 2014 23:03:27 -0700 | |
changeset 25565 | ce603b34c98d |
parent 23010 | 6dadb192ad81 |
child 25761 | c408b10ef757 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
20169
diff
changeset
|
2 |
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package javax.swing.plaf.basic; |
|
27 |
||
28 |
import javax.swing.*; |
|
29 |
import java.awt.Color; |
|
30 |
import java.awt.Dimension; |
|
31 |
import java.awt.Graphics; |
|
32 |
import java.awt.Insets; |
|
33 |
import java.awt.Rectangle; |
|
34 |
import javax.swing.plaf.ComponentUI; |
|
35 |
import javax.swing.plaf.SeparatorUI; |
|
36 |
||
37 |
||
38 |
/** |
|
20169 | 39 |
* A Basic L&F implementation of SeparatorUI. This implementation |
2 | 40 |
* is a "combined" view/controller. |
41 |
* |
|
42 |
* @author Georges Saab |
|
43 |
* @author Jeff Shapiro |
|
44 |
*/ |
|
45 |
||
46 |
public class BasicSeparatorUI extends SeparatorUI |
|
47 |
{ |
|
48 |
protected Color shadow; |
|
49 |
protected Color highlight; |
|
50 |
||
51 |
public static ComponentUI createUI( JComponent c ) |
|
52 |
{ |
|
53 |
return new BasicSeparatorUI(); |
|
54 |
} |
|
55 |
||
56 |
public void installUI( JComponent c ) |
|
57 |
{ |
|
58 |
installDefaults( (JSeparator)c ); |
|
59 |
installListeners( (JSeparator)c ); |
|
60 |
} |
|
61 |
||
62 |
public void uninstallUI(JComponent c) |
|
63 |
{ |
|
64 |
uninstallDefaults( (JSeparator)c ); |
|
65 |
uninstallListeners( (JSeparator)c ); |
|
66 |
} |
|
67 |
||
68 |
protected void installDefaults( JSeparator s ) |
|
69 |
{ |
|
70 |
LookAndFeel.installColors( s, "Separator.background", "Separator.foreground" ); |
|
71 |
LookAndFeel.installProperty( s, "opaque", Boolean.FALSE); |
|
72 |
} |
|
73 |
||
74 |
protected void uninstallDefaults( JSeparator s ) |
|
75 |
{ |
|
76 |
} |
|
77 |
||
78 |
protected void installListeners( JSeparator s ) |
|
79 |
{ |
|
80 |
} |
|
81 |
||
82 |
protected void uninstallListeners( JSeparator s ) |
|
83 |
{ |
|
84 |
} |
|
85 |
||
86 |
public void paint( Graphics g, JComponent c ) |
|
87 |
{ |
|
88 |
Dimension s = c.getSize(); |
|
89 |
||
90 |
if ( ((JSeparator)c).getOrientation() == JSeparator.VERTICAL ) |
|
91 |
{ |
|
92 |
g.setColor( c.getForeground() ); |
|
93 |
g.drawLine( 0, 0, 0, s.height ); |
|
94 |
||
95 |
g.setColor( c.getBackground() ); |
|
96 |
g.drawLine( 1, 0, 1, s.height ); |
|
97 |
} |
|
98 |
else // HORIZONTAL |
|
99 |
{ |
|
100 |
g.setColor( c.getForeground() ); |
|
101 |
g.drawLine( 0, 0, s.width, 0 ); |
|
102 |
||
103 |
g.setColor( c.getBackground() ); |
|
104 |
g.drawLine( 0, 1, s.width, 1 ); |
|
105 |
} |
|
106 |
} |
|
107 |
||
108 |
public Dimension getPreferredSize( JComponent c ) |
|
109 |
{ |
|
110 |
if ( ((JSeparator)c).getOrientation() == JSeparator.VERTICAL ) |
|
111 |
return new Dimension( 2, 0 ); |
|
112 |
else |
|
113 |
return new Dimension( 0, 2 ); |
|
114 |
} |
|
115 |
||
116 |
public Dimension getMinimumSize( JComponent c ) { return null; } |
|
117 |
public Dimension getMaximumSize( JComponent c ) { return null; } |
|
118 |
} |