~ubuntu-branches/ubuntu/vivid/kunststoff/vivid

« back to all changes in this revision

Viewing changes to src/com/incors/plaf/kunststoff/KunststoffTableHeaderUI.java

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-05-14 20:24:15 UTC
  • Revision ID: james.westby@ubuntu.com-20070514202415-00ophg1zvus0kmqw
Tags: upstream-2.0.2
ImportĀ upstreamĀ versionĀ 2.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package com.incors.plaf.kunststoff;
 
2
 
 
3
/*
 
4
 * This code was developed by INCORS GmbH (www.incors.com).
 
5
 * It is published under the terms of the GNU Lesser General Public License.
 
6
 *
 
7
 * This class was originally contributed by Jens Niemeyer, jens@jensn.de
 
8
 */
 
9
 
 
10
import java.awt.*;
 
11
import javax.swing.*;
 
12
import javax.swing.plaf.*;
 
13
import javax.swing.plaf.basic.*;
 
14
 
 
15
public class KunststoffTableHeaderUI extends BasicTableHeaderUI {
 
16
 
 
17
  public static ComponentUI createUI(JComponent c) {
 
18
    return new KunststoffTableHeaderUI();
 
19
  }
 
20
 
 
21
  public void paint(Graphics g, JComponent c) {
 
22
    super.paint(g, c);
 
23
 
 
24
    if (!c.isOpaque()) {
 
25
      return; // we only draw the gradients if the component is opaque
 
26
    }
 
27
 
 
28
    // paint reflection
 
29
    Color colorReflection = KunststoffLookAndFeel.getComponentGradientColorReflection();
 
30
    if (colorReflection != null) {
 
31
      Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0);
 
32
      Rectangle rect = new Rectangle(0, 0, c.getWidth(), c.getHeight()/2);
 
33
      KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rect, true);
 
34
    }
 
35
 
 
36
    // paint shadow
 
37
    Color colorShadow = KunststoffLookAndFeel.getComponentGradientColorShadow();
 
38
    if (colorShadow != null) {
 
39
      Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0);
 
40
      Rectangle rect = new Rectangle(0, c.getHeight()/2, c.getWidth(), c.getHeight()/2);
 
41
      KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rect, true);
 
42
    }
 
43
  }
 
44
}
 
45