01: // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
02: // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
03: // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
04: // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
05: // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
06: // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
07: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
08: // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
09: // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
10: // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
11: // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
12: // POSSIBILITY OF SUCH DAMAGE.
13: //
14: // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
15: package com.metaboss.applications.designstudio.components;
16:
17: import java.awt.Component;
18: import java.awt.Graphics;
19: import java.awt.Insets;
20: import java.awt.SystemColor;
21:
22: import javax.swing.border.AbstractBorder;
23:
24: public class EtchedLineBorder extends AbstractBorder {
25: final public static int TOP_BORDER = 0;
26: final public static int BOTTOM_BORDER = 1;
27:
28: private int mBorderType = TOP_BORDER;
29:
30: public EtchedLineBorder(int pBorderType) {
31: super ();
32: mBorderType = pBorderType;
33: }
34:
35: public void paintBorder(Component c, Graphics g, int x, int y,
36: int width, int height) {
37: switch (mBorderType) {
38: case TOP_BORDER:
39: y++;
40: g.setColor(SystemColor.controlShadow);
41: g.drawLine(x, y, width - 1, y);
42: g.setColor(SystemColor.controlLtHighlight);
43: g.drawLine(x, y + 1, width - 1, y + 1);
44: break;
45:
46: case BOTTOM_BORDER:
47: y += height;
48: g.setColor(SystemColor.controlShadow);
49: g.drawLine(x, y - 1, width - 1, y - 1);
50: g.setColor(SystemColor.controlLtHighlight);
51: g.drawLine(x, y, width - 1, y);
52: break;
53: }
54: }
55:
56: public Insets getBorderInsets(Component arg0) {
57: return new Insets(2, 2, 2, 2);
58: }
59: }
|