01: /*
02: * Copyright 2000,2005 wingS development team.
03: *
04: * This file is part of wingS (http://wingsframework.org).
05: *
06: * wingS is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU Lesser General Public License
08: * as published by the Free Software Foundation; either version 2.1
09: * of the License, or (at your option) any later version.
10: *
11: * Please see COPYING for the complete licence.
12: */
13: package org.wings.border;
14:
15: import org.wings.style.CSSProperty;
16:
17: import java.awt.*;
18:
19: /**
20: * Draw a beveled border around a component.
21: * <span style="border-style: outset; border-width: 3px;">RAISED</span>
22: * <span style="border-style: inset; border-width: 3px;">LOWERED</span>
23: *
24: * @author <a href="mailto:haaf@mercatis.de">Armin Haaf</a>
25: * @author <a href="mailto:andre@lison.de">Andre Lison</a>
26: */
27: public class SBevelBorder extends SAbstractBorder {
28: public static final int RAISED = 0;
29: public static final int LOWERED = 1;
30:
31: private int bevelType = RAISED;
32:
33: /**
34: * Creates a new beveled raised border.
35: */
36: public SBevelBorder() {
37: setBevelType(RAISED);
38: }
39:
40: /**
41: * Creates a new beveled border with the given type.
42: *
43: * @param bevelType one of the following constants:
44: * <code>RAISED</code> or <code>LOWERED</code>
45: */
46: public SBevelBorder(int bevelType) {
47: setBevelType(bevelType);
48: }
49:
50: /**
51: * Creates a new beveled border with the given type and insets.
52: *
53: * @param bevelType one of the following constants:
54: * <code>RAISED</code> or <code>LOWERED</code>
55: * @param insets (space between border and component) around
56: */
57: public SBevelBorder(int bevelType, Insets insets) {
58: super (Color.GRAY, 2, insets);
59: setBevelType(bevelType);
60: }
61:
62: /**
63: * Creates a new beveled border with the given type, insets and
64: * border thickness
65: *
66: * @param bevelType one of the following constants:
67: * <code>RAISED</code> or <code>LOWERED</code>
68: * @param insets padding (space between border and component) around
69: * @param thickness the thickness of drawn line
70: */
71: public SBevelBorder(int bevelType, Insets insets, int thickness) {
72: super (Color.GRAY, thickness, insets);
73: setBevelType(bevelType);
74: }
75:
76: /**
77: * sets the bevel type.
78: *
79: * @param bevelType one of the following constants:
80: * <code>RAISED</code> or <code>LOWERED</code>
81: */
82: public void setBevelType(int bevelType) {
83: this .bevelType = bevelType;
84: setStyle(bevelType == RAISED ? "outset" : "inset");
85: }
86:
87: /**
88: * returns the bevel type.
89: *
90: * @return the current bevel type
91: * @see #setBevelType
92: */
93: public int getBevelType() {
94: return bevelType;
95: }
96: }
|