Class RadioItem
public class RadioItem
extends org.eclipse.swt.widgets.Item
- Styles:
- LEFT, CENTER, RIGHT
- Events:
- (none)
Note: Only one of the styles LEFT, RIGHT, and CENTER may be specified.
IMPORTANT: This class is not intended to be subclassed.
-
Constructor Summary
Constructors Constructor Description RadioItem(RadioGroup parent, int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.RadioItem(RadioGroup parent, int style, int index)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance, and the index at which to place it in the items maintained by its parent. -
Method Summary
Modifier and Type Method Description (package private) void
clear()
(package private) void
deselect()
org.eclipse.swt.graphics.Color
getBackground()
Returns the receiver's background color.org.eclipse.swt.widgets.Button
getButton()
org.eclipse.swt.graphics.Font
getFont()
Returns the font that the receiver will use to paint textual information.org.eclipse.swt.graphics.Color
getForeground()
Returns the foreground color that the receiver will use to draw.org.eclipse.swt.graphics.Image
getImage()
RadioGroup
getParent()
Returns the receiver's RadioGroup parent.java.lang.String
getText()
boolean
isSelected()
Returnstrue
if the receiver is selected, and false otherwise.(package private) void
select()
void
setBackground(org.eclipse.swt.graphics.Color background)
Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.void
setFont(org.eclipse.swt.graphics.Font font)
Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.void
setForeground(org.eclipse.swt.graphics.Color foreground)
Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.void
setImage(org.eclipse.swt.graphics.Image image)
void
setText(java.lang.String string)
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
-
Constructor Details
-
RadioItem
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. The item is added to the end of the items maintained by its parent.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 theint
"|" operator) two or more of thoseSWT
style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.- Parameters:
parent
- a widget which will be the parent of the new instance (cannot be null)style
- the style of item to construct- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the parent is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- See Also:
SWT
,Widget.getStyle()
-
RadioItem
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance, and the index at which to place it in the items maintained by its parent.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 theint
"|" operator) two or more of thoseSWT
style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.- Parameters:
parent
- a widget which will be the parent of the new instance (cannot be null)style
- the style of item to constructindex
- the zero-relative index at which to store the receiver in its parent- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the parent is null
- ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the parent (inclusive)
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- See Also:
SWT
,Widget.getStyle()
-
-
Method Details
-
clear
void clear() -
deselect
void deselect() -
getBackground
public org.eclipse.swt.graphics.Color getBackground()Returns the receiver's background color.Note: This operation is a hint and may be overridden by the platform. For example, on some versions of Windows the background of a TabFolder, is a gradient rather than a solid color.
- Returns:
- the background color
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getButton
public org.eclipse.swt.widgets.Button getButton()- Returns:
- the button associated of this current item
-
getFont
public org.eclipse.swt.graphics.Font getFont()Returns the font that the receiver will use to paint textual information.- Returns:
- the receiver's font
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getForeground
public org.eclipse.swt.graphics.Color getForeground()Returns the foreground color that the receiver will use to draw.- Returns:
- the receiver's foreground color
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getImage
public org.eclipse.swt.graphics.Image getImage()- Overrides:
getImage
in classorg.eclipse.swt.widgets.Item
- See Also:
Item.getImage()
-
getParent
Returns the receiver's RadioGroup parent.- Returns:
- the receiver's image
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getText
public java.lang.String getText()- Overrides:
getText
in classorg.eclipse.swt.widgets.Item
- See Also:
Item.getText()
-
isSelected
public boolean isSelected()Returnstrue
if the receiver is selected, and false otherwise.When the receiver is of type
CHECK
orRADIO
, it is selected when it is checked. When it is of typeTOGGLE
, it is selected when it is pushed in. If the receiver is of any other type, this method returns false.- Returns:
- the selection state
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
select
void select() -
setBackground
public void setBackground(org.eclipse.swt.graphics.Color background)Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.Note: This operation is a hint and may be overridden by the platform.
- Parameters:
color
- the new color (or null)- Throws:
java.lang.IllegalArgumentException
-- ERROR_INVALID_ARGUMENT - if the argument has been disposed
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setFont
public void setFont(org.eclipse.swt.graphics.Font font)Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.- Parameters:
font
- the new font (or null)- Throws:
java.lang.IllegalArgumentException
-- ERROR_INVALID_ARGUMENT - if the argument has been disposed
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setForeground
public void setForeground(org.eclipse.swt.graphics.Color foreground)Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.Note: This operation is a hint and may be overridden by the platform.
- Parameters:
color
- the new color (or null)- Throws:
java.lang.IllegalArgumentException
-- ERROR_INVALID_ARGUMENT - if the argument has been disposed
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setImage
public void setImage(org.eclipse.swt.graphics.Image image)- Overrides:
setImage
in classorg.eclipse.swt.widgets.Item
- See Also:
Item.setImage(org.eclipse.swt.graphics.Image)
-
setText
public void setText(java.lang.String string)- Overrides:
setText
in classorg.eclipse.swt.widgets.Item
- See Also:
Item.setText(java.lang.String)
-