| 1 |
/* |
| 2 |
* @(#)EclipseGripperUI.java |
| 3 |
* |
| 4 |
* Copyright 2002 - 2004 JIDE Software Inc. All rights reserved. |
| 5 |
*/ |
| 6 |
package com.jidesoft.plaf.eclipse; |
| 7 |
|
| 8 |
import com.jidesoft.plaf.UIDefaultsLookup; |
| 9 |
import com.jidesoft.plaf.basic.BasicGripperUI; |
| 10 |
import com.jidesoft.swing.Gripper; |
| 11 |
import com.jidesoft.swing.JideSwingUtilities; |
| 12 |
|
| 13 |
import javax.swing.*; |
| 14 |
import javax.swing.plaf.ComponentUI; |
| 15 |
import java.awt.*; |
| 16 |
|
| 17 |
/** |
| 18 |
*/ |
| 19 |
public class EclipseGripperUI extends BasicGripperUI { |
| 20 |
|
| 21 |
protected Color _shadowColor; |
| 22 |
protected Color _darkShadowColor; |
| 23 |
protected Color _highlight; |
| 24 |
protected Color _lightHighlightColor; |
| 25 |
|
| 26 |
public static ComponentUI createUI(JComponent c) { |
| 27 |
return new EclipseGripperUI(); |
| 28 |
} |
| 29 |
|
| 30 |
@Override |
| 31 |
protected void installDefaults(Gripper s) { |
| 32 |
_shadowColor = UIDefaultsLookup.getColor("controlShadow"); |
| 33 |
_darkShadowColor = UIDefaultsLookup.getColor("controlDkShadow"); |
| 34 |
_highlight = UIDefaultsLookup.getColor("controlHighlight"); |
| 35 |
_lightHighlightColor = UIDefaultsLookup.getColor("controlLtHighlight"); |
| 36 |
super.installDefaults(s); |
| 37 |
} |
| 38 |
|
| 39 |
@Override |
| 40 |
protected void uninstallDefaults(Gripper s) { |
| 41 |
_shadowColor = null; |
| 42 |
_highlight = null; |
| 43 |
_lightHighlightColor = null; |
| 44 |
_darkShadowColor = null; |
| 45 |
super.uninstallDefaults(s); |
| 46 |
} |
| 47 |
|
| 48 |
@Override |
| 49 |
public void paint(Graphics g, JComponent c) { |
| 50 |
if (_gripperPainter == null) { |
| 51 |
getPainter().paintGripper(c, g, new Rectangle(0, 0, c.getWidth(), c.getHeight()), JideSwingUtilities.getOrientationOf(c), 0); |
| 52 |
} |
| 53 |
else { |
| 54 |
_gripperPainter.paint(c, g, new Rectangle(0, 0, c.getWidth(), c.getHeight()), JideSwingUtilities.getOrientationOf(c), 0); |
| 55 |
} |
| 56 |
} |
| 57 |
} |