Class AbstractCombo
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
- Direct Known Subclasses:
DateChooserCombo
public abstract class AbstractCombo
extends org.eclipse.swt.widgets.Composite
Text
, a
Button
and a popup associated to the button.
The creation of text, button and popup content is delegated to abstract methods.
Note that although this class is a subclass of Composite
,
it does not make sense to add children to it, or set a layout on it.
- Styles:
- BORDER, READ_ONLY, FLAT
- Events:
- Selection
-
Field Summary
Fields Modifier and Type Field Description (package private) org.eclipse.swt.widgets.Shell
_shell
The parent Shellprotected org.eclipse.swt.widgets.Button
button
Button opening the popupprotected boolean
createOnDrop
Flag indicating that the popup content must be created each time the combo is droppedprotected org.eclipse.swt.widgets.Listener
filter
Listener for external eventsstatic boolean
GTK
GTK platform constantprotected boolean
hasFocus
Flag indicating if the widget has focus or notprotected org.eclipse.swt.widgets.Listener
listener
Listener for all internal eventsprotected org.eclipse.swt.widgets.Shell
popup
Popup shell for the selectionprotected org.eclipse.swt.widgets.Control
popupContent
Content of the popupprotected boolean
showButtonOnFocus
Flag to show button only if combo has the focusprotected org.eclipse.swt.widgets.Text
text
Text widget for the inputstatic boolean
WIN32
WIN32 platform constant -
Constructor Summary
Constructors Constructor Description AbstractCombo(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. -
Method Summary
Modifier and Type Method Description void
addModifyListener(org.eclipse.swt.events.ModifyListener listener)
Adds the listener to the collection of listeners who will be notified when the receiver's text is modified, by sending it one of the messages defined in theModifyListener
interface.void
addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Adds the listener to the collection of listeners who will be notified when the receiver's selection changes, by sending it one of the messages defined in theSelectionListener
interface.void
addVerifyListener(org.eclipse.swt.events.VerifyListener listener)
Adds the listener to the collection of listeners who will be notified when the receiver's text is verified, by sending it one of the messages defined in theVerifyListener
interface.protected void
beforeDrop()
Called just before the popup is dropped.protected void
buttonEvent(org.eclipse.swt.widgets.Event event)
Manages button events.(package private) static int
checkStyle(int style)
protected void
comboEvent(org.eclipse.swt.widgets.Event event)
Manages global combo events.protected void
contentEvent(org.eclipse.swt.widgets.Event event)
Manages popup content events.void
copy()
Copies the selected text.protected org.eclipse.swt.widgets.Button
createButtonControl(int style)
Creates the arrow button widget.protected void
createPopup()
Creates the popup that will be displayed when the button is selected.protected abstract org.eclipse.swt.widgets.Control
createPopupContent(org.eclipse.swt.widgets.Composite parent)
Creates the popup content.protected org.eclipse.swt.widgets.Text
createTextControl(int style)
Creates the text widget.void
cut()
Cuts the selected text.protected abstract boolean
doSelection()
This method is called when a SWT.Selection is notify in the popup content, allowing to update the Text widget content.protected void
dropDown(boolean drop)
Manages drop down of the popup.boolean
getEditable()
Gets the editable state.boolean
getPopupVisible()
Returnstrue
if the receiver's popup is visible, andfalse
otherwise.org.eclipse.swt.graphics.Point
getSelection()
Returns aPoint
whose x coordinate is the start of the selection in the receiver's text field, and whose y coordinate is the end of the selection.org.eclipse.swt.widgets.Shell
getShell()
int
getStyle()
Returns the receiver's style information.java.lang.String
getText()
Returns a string containing a copy of the contents of the receiver's text field.int
getTextHeight()
Returns the height of the receivers's text field.int
getTextLimit()
Returns the maximum number of characters that the receiver's text field is capable of holding.protected void
handleFocus(int type)
Manages the focus on the combo.protected boolean
isDropped()
Returnstrue
if popup is dropped (visible), elsefalse
.boolean
isFocusControl()
Returnstrue
if the receiver has the user-interface focus, andfalse
otherwise.boolean
isShowButtonOnFocus()
Returnstrue
if button is displayed only when the combo has has focus andfalse
otherwise.void
paste()
Pastes text from clipboard.protected void
popupEvent(org.eclipse.swt.widgets.Event event)
Manages popup shell events.void
redraw()
Causes the entire bounds of the receiver to be marked as needing to be redrawn.void
redraw(int x, int y, int width, int height, boolean all)
Causes the rectangular area of the receiver specified by the arguments to be marked as needing to be redrawn.void
removeModifyListener(org.eclipse.swt.events.ModifyListener listener)
Removes the listener from the collection of listeners who will be notified when the receiver's text is modified.void
removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Removes the listener from the collection of listeners who will be notified when the receiver's selection changes.void
removeVerifyListener(org.eclipse.swt.events.VerifyListener listener)
Removes the listener from the collection of listeners who will be notified when the control is verified.void
selectAll()
Selects all the text in the receiver.void
setBackground(org.eclipse.swt.graphics.Color color)
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.protected void
setCreateOnDrop(boolean createOnDrop)
Sets the flag indicating if the popup content must be created each time the combo is dropped.void
setEditable(boolean editable)
Sets the editable state.void
setEnabled(boolean enabled)
Enables the receiver if the argument istrue
, and disables it otherwise.boolean
setFocus()
Causes the receiver to have the keyboard focus, such that all keyboard events will be delivered to it.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 color)
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
setLayout(org.eclipse.swt.widgets.Layout layout)
Sets the layout which is associated with the receiver to be the argument which may be null.void
setMenu(org.eclipse.swt.widgets.Menu menu)
Sets the receiver's pop up menu to the argument.protected void
setPopupLocation()
Calculates and returns the location of popup.
Called just before than the popup is dropped.void
setSelection(org.eclipse.swt.graphics.Point selection)
Sets the selection in the receiver's text field to the range specified by the argument whose x coordinate is the start of the selection and whose y coordinate is the end of the selection.void
setShowButtonOnFocus(boolean showButtonOnFocus)
Sets the flag indicating if the button must be shown only if the combo has the focus (true
).void
setTextLimit(int limit)
Sets the maximum number of characters that the receiver's text field is capable of holding to be the argument.void
setToolTipText(java.lang.String string)
Sets the receiver's tool tip text to the argument, which may be null indicating that no tool tip text should be shown.void
setVisible(boolean visible)
Marks the receiver as visible if the argument istrue
, and marks it invisible otherwise.protected void
textEvent(org.eclipse.swt.widgets.Event event)
Manages text widget events.protected void
updateButtonDisplay()
Updates the visibility of the button in function of the flag and the focus.Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setLayoutDeferred, setTabList, toString
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
Methods inherited from class org.eclipse.swt.widgets.Control
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, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setLayoutData, setLocation, setLocation, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setTouchEnabled, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData
-
Field Details
-
GTK
public static final boolean GTKGTK platform constant -
WIN32
public static final boolean WIN32WIN32 platform constant -
_shell
org.eclipse.swt.widgets.Shell _shellThe parent Shell -
text
protected org.eclipse.swt.widgets.Text textText widget for the input -
popup
protected org.eclipse.swt.widgets.Shell popupPopup shell for the selection -
button
protected org.eclipse.swt.widgets.Button buttonButton opening the popup -
popupContent
protected org.eclipse.swt.widgets.Control popupContentContent of the popup -
listener
protected org.eclipse.swt.widgets.Listener listenerListener for all internal events -
filter
protected org.eclipse.swt.widgets.Listener filterListener for external events -
hasFocus
protected boolean hasFocusFlag indicating if the widget has focus or not -
showButtonOnFocus
protected boolean showButtonOnFocusFlag to show button only if combo has the focus -
createOnDrop
protected boolean createOnDropFlag indicating that the popup content must be created each time the combo is dropped
-
-
Constructor Details
-
AbstractCombo
public AbstractCombo(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.- Parameters:
parent
- a widget which will be the parent of the new instance (cannot be null)style
- the style of widget to construct
-
-
Method Details
-
checkStyle
static int checkStyle(int style) -
addModifyListener
public void addModifyListener(org.eclipse.swt.events.ModifyListener listener)Adds the listener to the collection of listeners who will be notified when the receiver's text is modified, by sending it one of the messages defined in theModifyListener
interface.- Parameters:
listener
- the listener which should be notified- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
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
- See Also:
ModifyListener
,removeModifyListener(org.eclipse.swt.events.ModifyListener)
-
addSelectionListener
public void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)Adds the listener to the collection of listeners who will be notified when the receiver's selection changes, by sending it one of the messages defined in theSelectionListener
interface.widgetSelected
is called when the combo's list selection changes.widgetDefaultSelected
is typically called when ENTER is pressed the combo's text area.- Parameters:
listener
- the listener which should be notified- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
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
- See Also:
SelectionListener
,removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,SelectionEvent
-
addVerifyListener
public void addVerifyListener(org.eclipse.swt.events.VerifyListener listener)Adds the listener to the collection of listeners who will be notified when the receiver's text is verified, by sending it one of the messages defined in theVerifyListener
interface.- Parameters:
listener
- the listener which should be notified- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
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
- See Also:
VerifyListener
,removeVerifyListener(org.eclipse.swt.events.VerifyListener)
-
beforeDrop
protected void beforeDrop()Called just before the popup is dropped. Override to execute actions before the apparition of the popup.By default, do nothing.
-
buttonEvent
protected void buttonEvent(org.eclipse.swt.widgets.Event event)Manages button events.- Parameters:
event
- event
-
comboEvent
protected void comboEvent(org.eclipse.swt.widgets.Event event)Manages global combo events.- Parameters:
event
- event
-
contentEvent
protected void contentEvent(org.eclipse.swt.widgets.Event event)Manages popup content events. SelectionEvent are notified to all registered SelectionListeners of the combo.- Parameters:
event
- event
-
copy
public void copy()Copies the selected text.The current selection is copied to the clipboard.
- 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
-
createButtonControl
protected org.eclipse.swt.widgets.Button createButtonControl(int style)Creates the arrow button widget. Override to change appearance or behavior of the button.- Parameters:
style
- button style- Returns:
- The created button
-
createPopup
protected void createPopup()Creates the popup that will be displayed when the button is selected. Popup is a new Shell containing a unique Control. The content is specific to each implementation of the Combo and is created overriding the createPopupContent method. -
createPopupContent
protected abstract org.eclipse.swt.widgets.Control createPopupContent(org.eclipse.swt.widgets.Composite parent)Creates the popup content. The popup is dependent of each implementation. Content can be aList
, aTable
or every other control.
ThepopupContent
attribute must be set with the created control. The parent must be theshell
attribute, that is initialized by default with aFillLayout
.- Parameters:
parent
- The parent Composite that will contain the control- Returns:
- The created Control for the popup content
-
createTextControl
protected org.eclipse.swt.widgets.Text createTextControl(int style)Creates the text widget. Override to change appearance or behavior of the default text that is created here.- Parameters:
style
- text style- Returns:
- the created Text control
-
cut
public void cut()Cuts the selected text.The current selection is first copied to the clipboard and then deleted from the widget.
- 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
-
doSelection
protected abstract boolean doSelection()This method is called when a SWT.Selection is notify in the popup content, allowing to update the Text widget content.- Returns:
- true if the SWT.Selection event must be propagated, else false
-
dropDown
protected void dropDown(boolean drop)Manages drop down of the popup.- Parameters:
drop
-true
to drop the popup,false
to close
-
getEditable
public boolean getEditable()Gets the editable state.- Returns:
- whether or not the receiver is editable
- 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
-
getPopupVisible
public boolean getPopupVisible()Returnstrue
if the receiver's popup is visible, andfalse
otherwise.If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, this method may still indicate that it is considered visible even though it may not actually be showing.
- Returns:
- the receiver's popup's visibility 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
-
getSelection
public org.eclipse.swt.graphics.Point getSelection()Returns aPoint
whose x coordinate is the start of the selection in the receiver's text field, and whose y coordinate is the end of the selection. The returned values are zero-relative. An "empty" selection as indicated by the the x and y coordinates having the same value.- Returns:
- a point representing the selection start and end
- 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
-
getShell
public org.eclipse.swt.widgets.Shell getShell()- Overrides:
getShell
in classorg.eclipse.swt.widgets.Control
-
getStyle
public int getStyle()Returns the receiver's style information.- Overrides:
getStyle
in classorg.eclipse.swt.widgets.Widget
- See Also:
Widget.getStyle()
-
getText
public java.lang.String getText()Returns a string containing a copy of the contents of the receiver's text field.- Returns:
- the receiver's text
-
getTextHeight
public int getTextHeight()Returns the height of the receivers's text field.- Returns:
- the text height
- 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
-
getTextLimit
public int getTextLimit()Returns the maximum number of characters that the receiver's text field is capable of holding. If this has not been changed bysetTextLimit()
, it will be the constantCombo.LIMIT
.- Returns:
- the text limit
- 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
-
handleFocus
protected void handleFocus(int type)Manages the focus on the combo.- Parameters:
type
- SWT.FocusIn or SWT.FocusOut
-
isDropped
protected boolean isDropped()Returnstrue
if popup is dropped (visible), elsefalse
.- Returns:
- boolean indicating if popup is dropped
-
isFocusControl
public boolean isFocusControl()Returnstrue
if the receiver has the user-interface focus, andfalse
otherwise.- Overrides:
isFocusControl
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.isFocusControl()
-
isShowButtonOnFocus
public boolean isShowButtonOnFocus()Returnstrue
if button is displayed only when the combo has has focus andfalse
otherwise.- Returns:
- boolean indicating if combo must show button only on focus
-
paste
public void paste()Pastes text from clipboard.The selected text is deleted from the widget and new text inserted from the clipboard.
- 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
-
popupEvent
protected void popupEvent(org.eclipse.swt.widgets.Event event)Manages popup shell events.- Parameters:
event
- event
-
redraw
public void redraw()Causes the entire bounds of the receiver to be marked as needing to be redrawn. The next time a paint request is processed, the control will be completely painted, including the background.- Overrides:
redraw
in classorg.eclipse.swt.widgets.Control
-
redraw
public void redraw(int x, int y, int width, int height, boolean all)Causes the rectangular area of the receiver specified by the arguments to be marked as needing to be redrawn. The next time a paint request is processed, that area of the receiver will be painted, including the background. If the all flag is true, any children of the receiver which intersect with the specified area will also paint their intersecting areas. If the all flag is false, the children will not be painted.- Overrides:
redraw
in classorg.eclipse.swt.widgets.Control
- Parameters:
x
-y
-width
-height
-all
-
-
removeModifyListener
public void removeModifyListener(org.eclipse.swt.events.ModifyListener listener)Removes the listener from the collection of listeners who will be notified when the receiver's text is modified.- Parameters:
listener
- the listener which should no longer be notified- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
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
- See Also:
ModifyListener
,addModifyListener(org.eclipse.swt.events.ModifyListener)
-
removeSelectionListener
public void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)Removes the listener from the collection of listeners who will be notified when the receiver's selection changes.- Parameters:
listener
- the listener which should no longer be notified- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
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
- See Also:
SelectionListener
,addSelectionListener(org.eclipse.swt.events.SelectionListener)
-
removeVerifyListener
public void removeVerifyListener(org.eclipse.swt.events.VerifyListener listener)Removes the listener from the collection of listeners who will be notified when the control is verified.- Parameters:
listener
- the listener which should no longer be notified- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
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
- See Also:
VerifyListener
,addVerifyListener(org.eclipse.swt.events.VerifyListener)
-
selectAll
public void selectAll()Selects all the text in the receiver.- 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
-
setBackground
public void setBackground(org.eclipse.swt.graphics.Color color)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.- Overrides:
setBackground
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setBackground(org.eclipse.swt.graphics.Color)
-
setCreateOnDrop
protected void setCreateOnDrop(boolean createOnDrop)Sets the flag indicating if the popup content must be created each time the combo is dropped. It can be necessary to set this flag to true when the popup content use to many controls, as the DateChooser.- Parameters:
createOnDrop
- true if popup is recreated at each drop, else false
-
setEditable
public void setEditable(boolean editable)Sets the editable state.- Parameters:
editable
- the new editable state
-
setEnabled
public void setEnabled(boolean enabled)Enables the receiver if the argument istrue
, and disables it otherwise.- Overrides:
setEnabled
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setEnabled(boolean)
-
setFocus
public boolean setFocus()Causes the receiver to have the keyboard focus, such that all keyboard events will be delivered to it.- Overrides:
setFocus
in classorg.eclipse.swt.widgets.Composite
- See Also:
Control.setFocus()
-
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.- Overrides:
setFont
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setFont(org.eclipse.swt.graphics.Font)
-
setForeground
public void setForeground(org.eclipse.swt.graphics.Color color)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.- Overrides:
setForeground
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setForeground(org.eclipse.swt.graphics.Color)
-
setLayout
public void setLayout(org.eclipse.swt.widgets.Layout layout)Sets the layout which is associated with the receiver to be the argument which may be null.Note : No Layout can be set on this Control because it already manages the size and position of its children.
- Overrides:
setLayout
in classorg.eclipse.swt.widgets.Composite
- Parameters:
layout
- the receiver's new layout or null
-
setMenu
public void setMenu(org.eclipse.swt.widgets.Menu menu)Sets the receiver's pop up menu to the argument. All controls may optionally have a pop up menu that is displayed when the user requests one for the control. The sequence of key strokes, button presses and/or button releases that are used to request a pop up menu is platform specific. Note: Disposing of a control that has a pop up menu will dispose of the menu. To avoid this behavior, set the menu to null before the control is disposed.- Overrides:
setMenu
in classorg.eclipse.swt.widgets.Control
- Parameters:
menu
- the new pop up menu
-
setPopupLocation
protected void setPopupLocation()Calculates and returns the location of popup.
Called just before than the popup is dropped. -
setSelection
public void setSelection(org.eclipse.swt.graphics.Point selection)Sets the selection in the receiver's text field to the range specified by the argument whose x coordinate is the start of the selection and whose y coordinate is the end of the selection.- Parameters:
selection
- a point representing the new selection start and end
-
setShowButtonOnFocus
public void setShowButtonOnFocus(boolean showButtonOnFocus)Sets the flag indicating if the button must be shown only if the combo has the focus (true
).- Parameters:
showButtonOnFocus
-true
if button must be shown on focus only
-
setTextLimit
public void setTextLimit(int limit)Sets the maximum number of characters that the receiver's text field is capable of holding to be the argument.- Parameters:
limit
- new text limit- Throws:
java.lang.IllegalArgumentException
-- ERROR_CANNOT_BE_ZERO - if the limit is zero
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
-
setToolTipText
public void setToolTipText(java.lang.String string)Sets the receiver's tool tip text to the argument, which may be null indicating that no tool tip text should be shown.- Overrides:
setToolTipText
in classorg.eclipse.swt.widgets.Control
- Parameters:
string
- the new tool tip text (or null)
-
setVisible
public void setVisible(boolean visible)Marks the receiver as visible if the argument istrue
, and marks it invisible otherwise.- Overrides:
setVisible
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setVisible(boolean)
-
textEvent
protected void textEvent(org.eclipse.swt.widgets.Event event)Manages text widget events. ModifyEvent are notified to all registered ModifyListener of the combo.- Parameters:
event
- event
-
updateButtonDisplay
protected void updateButtonDisplay()Updates the visibility of the button in function of the flag and the focus.
-