01: /*
02: * IzPack - Copyright 2001-2008 Julien Ponge, All Rights Reserved.
03: *
04: * http://izpack.org/
05: * http://izpack.codehaus.org/
06: *
07: * Licensed under the Apache License, Version 2.0 (the "License");
08: * you may not use this file except in compliance with the License.
09: * You may obtain a copy of the License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS,
15: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: * See the License for the specific language governing permissions and
17: * limitations under the License.
18: */
19:
20: package com.izforge.izpack.gui;
21:
22: import java.awt.Component;
23: import java.awt.Graphics;
24:
25: import javax.swing.border.EtchedBorder;
26:
27: /**
28: * Draws an etched line border.
29: *
30: * @author Julien Ponge
31: */
32: public class EtchedLineBorder extends EtchedBorder {
33:
34: private static final long serialVersionUID = 3256999956257649201L;
35:
36: /**
37: * Paints the etched line.
38: *
39: * @param c The component to draw the border on.
40: * @param g The graphics object.
41: * @param x The top-left x.
42: * @param y The top-left y.
43: * @param width The border width.
44: * @param height The border height.
45: */
46: public void paintBorder(Component c, Graphics g, int x, int y,
47: int width, int height) {
48: g.translate(x, y);
49:
50: g.setColor(etchType == LOWERED ? getShadowColor(c)
51: : getHighlightColor(c));
52: g.drawLine(10, 0, width - 2, 0);
53:
54: g.setColor(etchType == LOWERED ? getHighlightColor(c)
55: : getShadowColor(c));
56: g.drawLine(10, 1, width - 2, 1);
57:
58: g.translate(0 - x, 0 - y);
59: }
60: }
|