root / import / ext3D / trunk / install-extension3d / IzPack / src / lib / com / izforge / izpack / gui / EtchedLineBorder.java @ 15280
History | View | Annotate | Download (2.57 KB)
1 |
/*
|
---|---|
2 |
* $Id: EtchedLineBorder.java,v 1.1 2006/06/14 07:29:07 cesar Exp $
|
3 |
* IzPack
|
4 |
* Copyright (c) 2003, Julien Ponge <julien@izforge.com>
|
5 |
* All rights reserved.
|
6 |
*
|
7 |
* Redistribution and use in source and binary forms, with or without
|
8 |
* modification, are permitted provided that the following conditions are met:
|
9 |
*
|
10 |
* 1. Redistributions of source code must retain the above copyright notice,
|
11 |
* this list of conditions and the following disclaimer.
|
12 |
* 2. Redistributions in binary form must reproduce the above copyright
|
13 |
* notice, this list of conditions and the following disclaimer in the
|
14 |
* documentation and/or other materials provided with the distribution.
|
15 |
* 3. Neither the name of IzPack nor the names of its
|
16 |
* contributors may be used to endorse or promote products derived from
|
17 |
* this software without specific prior written permission.
|
18 |
*
|
19 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20 |
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
22 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
23 |
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
24 |
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25 |
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26 |
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27 |
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28 |
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29 |
* POSSIBILITY OF SUCH DAMAGE.
|
30 |
*
|
31 |
*/
|
32 |
|
33 |
package com.izforge.izpack.gui; |
34 |
|
35 |
import java.awt.Component; |
36 |
import java.awt.Graphics; |
37 |
|
38 |
import javax.swing.border.EtchedBorder; |
39 |
|
40 |
/**
|
41 |
* Draws an etched line border.
|
42 |
* @author Julien Ponge
|
43 |
*/
|
44 |
public class EtchedLineBorder extends EtchedBorder |
45 |
{ |
46 |
/**
|
47 |
* Paints the etched line.
|
48 |
* @param c The component to draw the border on.
|
49 |
* @param g The graphics object.
|
50 |
* @param x The top-left x.
|
51 |
* @param y The top-left y.
|
52 |
* @param width The border width.
|
53 |
* @param height The border height.
|
54 |
*/
|
55 |
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) |
56 |
{ |
57 |
g.translate(x, y); |
58 |
|
59 |
g.setColor(etchType == LOWERED? getShadowColor(c) : getHighlightColor(c)); |
60 |
g.drawLine(10, 0, width - 2, 0); |
61 |
|
62 |
g.setColor(etchType == LOWERED? getHighlightColor(c) : getShadowColor(c)); |
63 |
g.drawLine(10, 1, width - 2, 1); |
64 |
|
65 |
g.translate(0 - x, 0 - y); |
66 |
} |
67 |
} |