01: /*
02: * Copyright Javelin Software, All rights reserved.
03: */
04:
05: package com.javelin.swinglets;
06:
07: import java.awt.*;
08: import java.util.*;
09: import java.io.*;
10:
11: /**
12: * SRadioButton defines a radio button.
13: * The .toString() is displayed as the string value.
14: *
15: * @author Robin Sharp
16: */
17:
18: public class SRadioButton extends SToggleButton {
19: /**
20: * Creates a SRadioButton with the following text and if selected.
21: */
22: public SRadioButton(String text, boolean selected) {
23: super (text, selected);
24: }
25:
26: /**
27: * Creates a SRadioButton with the following text and unselected.
28: */
29: public SRadioButton(String text) {
30: this (text, false);
31: }
32:
33: /**
34: * Creates a SRadioButton with no text and if selected.
35: */
36: public SRadioButton(boolean selected) {
37: this ("", selected);
38: }
39:
40: /**
41: * Creates a SRadioButton unselected.
42: */
43: public SRadioButton() {
44: this (false);
45: }
46:
47: /**
48: * Returns the name of the L&F class that renders this component.
49: */
50: public Class getUIClass() {
51: return SRadioButton.class;
52: }
53:
54: /**
55: * Returns the alignment of the text relative to the icon.
56: */
57: public int getTextAlignment() {
58: return textAlignment;
59: }
60:
61: /**
62: * Sets the alignment of the text relative to the icon.
63: * One of SConstants LEFT, RIGHT
64: */
65: public SComponent setTextAlignment(int textAlignment) {
66: firePropertyChange("textAlignment", this .textAlignment,
67: this .textAlignment = textAlignment);
68: return this ;
69: }
70:
71: /**
72: * Get the group that this button belongs to.
73: */
74: public SButtonGroup getGroup() {
75: return group;
76: }
77:
78: /**
79: * Set the group that this button belongs to.
80: */
81: void setGroup(SButtonGroup group) {
82: firePropertyChange("group", this .group, this .group = group);
83: }
84:
85: // PRIVATE /////////////////////////////////////////////////
86:
87: protected SButtonGroup group;
88: protected int textAlignment = SConstants.RIGHT;
89:
90: }
|