01: package net.xoetrope.awt;
02:
03: import java.awt.Color;
04: import java.awt.Dimension;
05: import java.awt.Graphics;
06:
07: /**
08: * Paint a tab item
09: * <p> Copyright (c) Xoetrope Ltd., 2002-2004</p>
10: * <p> $Revision: 1.1 $</p>
11: * <p> License: see License.txt</p>
12: */
13: public class XTab extends XLabel {
14: protected boolean selected = false;
15:
16: public XTab(String title) {
17: super ();
18: setText(title);
19: }
20:
21: public void setSelected(boolean isSelected) {
22: selected = isSelected;
23: }
24:
25: public void paint(Graphics g) {
26: Dimension size = getSize();
27: Color c = g.getColor();
28: g.setColor(getBackground());
29: g.fill3DRect(1, 1, size.width - 1, size.height + 4, selected);
30: g.setColor(getForeground());
31: g.drawString(getText(), 6, 17);
32: g.setColor(c);
33: }
34:
35: public void update(Graphics g) {
36: paint(g);
37: }
38: }
|