public class RadioGroup
extends org.eclipse.swt.widgets.Composite
SWT Widget that presents a group of radio buttons.
Note: Only one of the styles HORIZONTAL and VERTICAL may be specified.
Note: Only one of the styles LEFT, RIGHT, and CENTER may be specified.
Note: Only one of the styles LEFT_TO_RIGHT and RIGHT_TO_LEFT may be specified.
NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS.
IMPORTANT: This class is not intended to be subclassed.
Constructor and Description |
---|
RadioGroup(org.eclipse.swt.widgets.Composite parent,
int style)
Constructs a new instance of this class given its parent
and a style value describing its behavior and appearance.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addItem(RadioItem item,
int position) |
void |
addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Adds the listener to the collection of listeners who will
be notified when the control is selected by the user, by sending
it one of the messages defined in the
SelectionListener
interface. |
void |
clear(int position)
Reset the button at position
position (reset content to empty string, reset font, images...) |
(package private) org.eclipse.swt.widgets.Button |
createButton(int itemStyle,
int position) |
void |
deselectAll()
Deselects all selected items in the receiver's list.
|
int |
getItemCount()
Returns the number of items contained in the receiver's list.
|
RadioItem[] |
getItems()
Returns a (possibly empty) array of
RadioItem s which are
the items in the receiver's list. |
RadioItem |
getSelection()
Returns the the item which is currently selected in the receiver's list, or
null if no item is selected. |
int |
getSelectionIndex()
Returns the zero-relative index of the item which is currently
selected in the receiver's list, or -1 if no item is selected.
|
int |
getStyle() |
int |
indexOf(RadioItem item)
Searches the receiver's list starting at the first item
(index 0) until an item is found that is equal to the
argument, and returns the index of that item.
|
(package private) void |
itemSelected(RadioItem item) |
void |
remove(int index)
Removes the item from the receiver's list at the given
zero-relative index.
|
void |
remove(int start,
int end)
Removes the items from the receiver's list which are
between the given zero-relative start and end
indices (inclusive).
|
void |
remove(RadioItem item)
Searches the receiver's list starting at the first item
until an item is found that is equal to the argument,
and removes that item from the list.
|
void |
removeAll()
Removes all of the items from the receiver's list and clear the
contents of receiver's text field.
|
(package private) void |
removeItem(RadioItem item) |
void |
removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Removes the listener from the collection of listeners who will
be notified when the user changes the receiver's selection.
|
void |
select(int index)
Selects the item at the given zero-relative index in the receiver's
list.
|
void |
setLayout(org.eclipse.swt.widgets.Layout layout) |
void |
setSelection(RadioItem item)
Sets the selection in the receiver
|
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public RadioGroup(org.eclipse.swt.widgets.Composite parent, int style)
The style value is either one of the style constants defined in
class SWT
which is applicable to instances of this
class, or must be built by bitwise OR'ing together
(that is, using the int
"|" operator) two or more
of those SWT
style constants. The class description
lists the style constants that are applicable to the class.
Style bits are also inherited from superclasses.
parent
- a widget which will be the parent of the new instance (cannot be null)style
- the style of widget to constructjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- SWT.NO_BACKGROUND
,
SWT.NO_FOCUS
,
SWT.NO_MERGE_PAINTS
,
SWT.NO_REDRAW_RESIZE
,
SWT.NO_RADIO_GROUP
,
SWT.EMBEDDED
,
SWT.DOUBLE_BUFFERED
,
Widget.getStyle()
void addItem(RadioItem item, int position)
public void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
SelectionListener
interface.
widgetSelected
is called when the control is selected by the user.
widgetDefaultSelected
is not called.
When the SWT.RADIO
style bit is set, the widgetSelected
method is
also called when the receiver loses selection because another item in the same radio group
was selected by the user. During widgetSelected
the application can use
getSelection()
to determine the current selected state of the receiver.
listener
- the listener which should be notifiedjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- SelectionListener
,
removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,
SelectionEvent
public void clear(int position)
position
(reset content to empty string, reset font, images...)listener
- the listener which should be notifiedorg.eclipse.swt.SWTException
- org.eclipse.swt.widgets.Button createButton(int itemStyle, int position)
public void deselectAll()
Note: To clear the selection in the receiver's text field,
use clearSelection()
.
org.eclipse.swt.SWTException
- public int getItemCount()
org.eclipse.swt.SWTException
- public RadioItem[] getItems()
RadioItem
s which are
the items in the receiver's list.
Note: This is not the actual structure used by the receiver to maintain its list of items, so modifying the array will not affect the receiver.
org.eclipse.swt.SWTException
- public RadioItem getSelection()
null
if no item is selected.org.eclipse.swt.SWTException
- public int getSelectionIndex()
org.eclipse.swt.SWTException
- public int getStyle()
getStyle
in class org.eclipse.swt.widgets.Widget
Widget.getStyle()
public int indexOf(RadioItem item)
item
- the search itemorg.eclipse.swt.SWTException
- void itemSelected(RadioItem item)
public void remove(int index)
index
- the index for the itemjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void remove(int start, int end)
start
- the start of the rangeend
- the end of the rangejava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void remove(RadioItem item)
item
- the item to removejava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void removeAll()
org.eclipse.swt.SWTException
- void removeItem(RadioItem item)
public void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- SelectionListener
,
addSelectionListener(org.eclipse.swt.events.SelectionListener)
public void select(int index)
index
- the index of the item to selectorg.eclipse.swt.SWTException
- public void setLayout(org.eclipse.swt.widgets.Layout layout)
setLayout
in class org.eclipse.swt.widgets.Composite
Composite.setLayout(org.eclipse.swt.widgets.Layout)
public void setSelection(RadioItem item)
item
- new selectionjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
-