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) voidclear()(package private) voiddeselect()org.eclipse.swt.graphics.ColorgetBackground()Returns the receiver's background color.org.eclipse.swt.widgets.ButtongetButton()org.eclipse.swt.graphics.FontgetFont()Returns the font that the receiver will use to paint textual information.org.eclipse.swt.graphics.ColorgetForeground()Returns the foreground color that the receiver will use to draw.org.eclipse.swt.graphics.ImagegetImage()RadioGroupgetParent()Returns the receiver's RadioGroup parent.java.lang.StringgetText()booleanisSelected()Returnstrueif the receiver is selected, and false otherwise.(package private) voidselect()voidsetBackground(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.voidsetFont(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.voidsetForeground(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.voidsetImage(org.eclipse.swt.graphics.Image image)voidsetText(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
SWTwhich 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 thoseSWTstyle 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
SWTwhich 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 thoseSWTstyle 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:
getImagein 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:
getTextin classorg.eclipse.swt.widgets.Item- See Also:
Item.getText()
-
isSelected
public boolean isSelected()Returnstrueif the receiver is selected, and false otherwise.When the receiver is of type
CHECKorRADIO, 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:
setImagein classorg.eclipse.swt.widgets.Item- See Also:
Item.setImage(org.eclipse.swt.graphics.Image)
-
setText
public void setText(java.lang.String string)- Overrides:
setTextin classorg.eclipse.swt.widgets.Item- See Also:
Item.setText(java.lang.String)
-