Top Description Fields Constructors Methods
org.eclipse.swt.widgets

public Class IME

extends Widget
Class Inheritance
Imports
org.eclipse.swt.*, org.eclipse.swt.graphics.*, org.eclipse.swt.internal.*, org.eclipse.swt.internal.gtk.*

Instances of this class represent input method editors. These are typically in-line pre-edit text areas that allow the user to compose characters from Far Eastern languages such as Japanese, Chinese or Korean.
Styles:
(none)
Events:
ImeComposition

Important Note

This class is not intended to be subclassed.

Since
3.4
See Also
Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv int
pack-priv boolean
pack-priv Canvas
pack-priv int[]
pack-priv int
pack-priv TextStyle[]
pack-priv String
Inherited from org.eclipse.swt.widgets.Widget:
ACTIVATEACTIVATE_INVERSEAUTO_TEXT_DIRECTIONBACKGROUNDBACKSPACEBACKSPACE_INVERSEBUTTON_PRESS_EVENTBUTTON_PRESS_EVENT_INVERSEBUTTON_RELEASE_EVENTBUTTON_RELEASE_EVENT_INVERSECANVASCHANGE_VALUECHANGEDCHECK_SUBWINDOWCLICKEDCLOSE_REQUESTCOMMITCOMPUTE_SIZECONFIGURE_EVENTCOPY_CLIPBOARDCOPY_CLIPBOARD_INVERSECREATE_MENU_PROXYCUT_CLIPBOARDCUT_CLIPBOARD_INVERSEdataDAY_SELECTEDDAY_SELECTED_DOUBLE_CLICKDECELERATEDEFAULT_HEIGHTDEFAULT_WIDTHDELETE_EVENTDELETE_FROM_CURSORDELETE_FROM_CURSOR_INVERSEDELETE_RANGEDELETE_TEXTDIRECTION_CHANGEDDISABLEDdisplayDISPOSE_SENTDISPOSEDDPI_CHANGEDDRAG_DETECTDRAWENTERENTER_NOTIFY_EVENTEVENTEVENT_AFTEReventTableEXPAND_COLLAPSE_CURSOR_ROWEXPOSE_EVENTEXPOSE_EVENT_INVERSEFOCUSFOCUS_INFOCUS_IN_EVENTFOCUS_OUTFOCUS_OUT_EVENTFONTFOREGROUNDFOREIGN_HANDLEgdkSeatGrabPrepareFuncGESTURE_PRESSEDGESTURE_RELEASEDGRAB_FOCUShandleHANDLEHAS_AUTO_DIRECTIONHIDDENHIDEICON_RELEASEIM_UPDATEINPUTINSERT_TEXTIS_ACTIVEKEY_CHECK_SUBWINDOWKEY_GTK_CSSKEY_PRESS_EVENTKEY_PRESSEDKEY_RELEASE_EVENTKEY_RELEASEDKEYED_DATALAST_SIGNALLAYOUT_CHANGEDLAYOUT_CHILDLAYOUT_NEEDEDLEAVELEAVE_NOTIFY_EVENTMAPMAP_EVENTMENUMNEMONIC_ACTIVATEMONTH_CHANGEDMOTIONMOTION_INVERSEMOTION_NOTIFY_EVENTMOTION_NOTIFY_EVENT_INVERSEMOVE_CURSORMOVE_CURSOR_INVERSEMOVE_FOCUSMOVEDNOTIFY_DEFAULT_HEIGHTNOTIFY_DEFAULT_WIDTHNOTIFY_MAXIMIZEDNOTIFY_STATEOBSCUREDOUTPUTPARENT_BACKGROUNDPASTE_CLIPBOARDPASTE_CLIPBOARD_INVERSEPOPPED_UPPOPULATE_POPUPPOPUP_MENUPREEDIT_CHANGEDREALIZERELEASEDRESIZEDROW_ACTIVATEDROW_DELETEDROW_HAS_CHILD_TOGGLEDROW_INSERTEDSCROLLSCROLL_BEGINSCROLL_CHILDSCROLL_ENDSCROLL_EVENTSELECTSELECTION_DONESHOWSHOW_HELPSIZE_ALLOCATESIZE_ALLOCATE_GTK4SKIN_NEEDEDSTART_INTERACTIVE_SEARCHstateSTATUS_ICON_POPUP_MENUstyleSTYLE_UPDATEDSWITCH_PAGETEST_COLLAPSE_ROWTEST_EXPAND_ROWTEXT_BUFFER_INSERT_TEXTTHEME_BACKGROUNDTOGGLEDUNMAPUNMAP_EVENTUNREALIZEVALUE_CHANGEDWINDOW_STATE_EVENTZERO_HEIGHTZERO_WIDTH

Constructor Summary

AccessConstructor and Description
pack-priv
IME()

Prevents uninitialized instances from being created outside the package.

public
IME(Canvas
a canvas control which will be the parent of the new instance (cannot be null)
parent
,
int
the style of control to construct
style
)

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
public int

Returns:

the caret offset
getCaretOffset
()

Returns the offset of the caret from the start of the document.

public int

Returns:

the commit count
getCommitCount
()

Returns the commit count of the composition.

public int

Returns:

the offset of the composition
getCompositionOffset
()

Returns the offset of the composition from the start of the document.

public int[]

Returns:

the ranges for the styles
getRanges
()

Returns the ranges for the style that should be applied during the in-line edit session.

public TextStyle[]

Returns:

the ranges for the styles
getStyles
()

Returns the styles for the ranges.

public String

Returns:

the widget text
getText
()

Returns the composition text.

public boolean

Returns:

the wide caret state
getWideCaret
()

Returns true if the caret should be wide, and false otherwise.

pack-priv long
pack-priv long
gtk_commit(long imcontext, long textPtr)

Overrides org.eclipse.swt.widgets.Widget.gtk_commit.

pack-priv long
pack-priv long
pack-priv boolean
pack-priv void
pack-priv void
public void
setCompositionOffset(int
the offset of the composition
offset
)

Sets the offset of the composition from the start of the document.

Inherited from org.eclipse.swt.widgets.Widget:
_addListeneraddDisposeListeneraddListenercellDataProccheckBitscheckOpencheckOrientationcheckParentcheckSubclasscheckWidgetconvertPangoFontDescriptionToCsscreateHandlecreateWidgetcssHandlederegisterdestroyWidgetdisposedpiChangedenterMotionProcerrorfilterProcfiltersfixMnemonicfixMnemonicfixMnemonicfocusProcfontHeightgdk_event_freegdk_event_get_stategdk_event_get_surface_or_windowgdk_pointer_grabgdk_pointer_ungrabgdk_surface_get_sizegdk_window_get_sizeGdkSeatGrabPrepareFuncgesturePressReleaseProcgetDatagetDatagetDisplaygetListenersgetNamegetNameTextgetStylegtk3_show_helpgtk4_drawgtk4_enter_eventgtk4_focus_enter_eventgtk4_focus_leave_eventgtk4_focus_window_eventgtk4_key_press_eventgtk4_key_release_eventgtk4_leave_eventgtk4_motion_eventgtk4_scroll_eventgtk_activategtk_adjustment_getgtk_box_newgtk_box_pack_endgtk_box_set_child_packinggtk_button_release_eventgtk_cell_renderer_get_preferred_sizegtk_change_valuegtk_changedgtk_clickedgtk_close_requestgtk_configure_eventgtk_container_get_border_width_or_margingtk_container_set_border_widthgtk_create_menu_proxygtk_day_selectedgtk_day_selected_double_clickgtk_delete_eventgtk_delete_rangegtk_delete_textgtk_drawgtk_enter_notify_eventgtk_event_aftergtk_expand_collapse_cursor_rowgtk_focusgtk_focus_in_eventgtk_focus_out_eventgtk_gesture_press_eventgtk_gesture_release_eventgtk_grab_focusgtk_hidegtk_icon_releasegtk_inputgtk_insert_textgtk_key_press_eventgtk_key_release_eventgtk_leave_notify_eventgtk_mapgtk_map_eventgtk_menu_popped_upgtk_mnemonic_activategtk_month_changedgtk_motion_notify_eventgtk_move_focusgtk_outputgtk_populate_popupgtk_popup_menugtk_realizegtk_row_activatedgtk_row_has_child_toggledgtk_scroll_childgtk_scroll_eventgtk_selectgtk_selection_donegtk_showgtk_size_allocategtk_start_interactive_searchgtk_status_icon_popup_menugtk_style_updatedgtk_switch_pagegtk_test_collapse_rowgtk_test_expand_rowgtk_text_buffer_insert_textgtk_timergtk_toggledgtk_tree_view_column_cell_get_positiongtk_unmapgtk_unmap_eventgtk_unrealizegtk_value_changedgtk_widget_get_preferred_sizegtk_widget_get_surfacegtk_widget_get_windowgtk_widget_size_allocategtk_window_state_eventhookEventshookshoverProcisActiveisAutoDirectionisDisposedisListeningisValidSubclassisValidThreadkeyPressReleaseProcleaveProcmnemonicHitmnemonicMatchnotifyCreationTrackernotifyDisposalTrackernotifyListenersnotifyProcnotifyStatepaintSurfacepaintWindowpostEventpostEventregisterreleasereleaseChildrenreleaseHandleremoveDisposeListenerremoveListenerremoveListenerrendererGetPreferredWidthProcrendererRenderProcrendererSnapshotProcreskinreskinChildrenreskinWidgetscrollProcsendEventsendEventsendEventsendEventsendIMKeyEventsendKeyEventsendSelectionEventsendSelectionEventsetButtonStatesetDatasetDatasetFontDescriptionsetInputStatesetKeyStatesetLocationStatesetOrientationsetTabGroupFocussetTabItemFocussetToolTipTextshellMapProcsizeAllocateProcsizeRequestProcsnapshotToDrawtimerProctopHandletoStringtranslateTraversalwindowActiveProcwindowProcwindowProcwindowProcwindowProcwindowProc

Field Detail

caretOffsetback to summary
pack-priv int caretOffset
commitCountback to summary
pack-priv int commitCount
inCompositionback to summary
pack-priv boolean inComposition
parentback to summary
pack-priv Canvas parent
rangesback to summary
pack-priv int[] ranges
startOffsetback to summary
pack-priv int startOffset
stylesback to summary
pack-priv TextStyle[] styles
textback to summary
pack-priv String text

Constructor Detail

IMEback to summary
pack-priv IME()

Prevents uninitialized instances from being created outside the package.

IMEback to summary
public IME(Canvas parent, int style)

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

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.

Parameters
parent:Canvas

a canvas control which will be the parent of the new instance (cannot be null)

style:int

the style of control to construct

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the parent is null
SWTException:
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
See Also
Widget#checkSubclass, Widget#getStyle

Method Detail

createWidgetback to summary
pack-priv void createWidget()
getCaretOffsetback to summary
public int getCaretOffset()

Returns the offset of the caret from the start of the document. -1 means that there is currently no active composition. The caret is within the current composition.

Returns:int

the caret offset

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getCommitCountback to summary
public int getCommitCount()

Returns the commit count of the composition. This is the number of characters that have been composed. When the commit count is equal to the length of the composition text, then the in-line edit operation is complete.

Returns:int

the commit count

Exceptions
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
IME#getText
getCompositionOffsetback to summary
public int getCompositionOffset()

Returns the offset of the composition from the start of the document. This is the start offset of the composition within the document and in not changed by the input method editor itself during the in-line edit session.

Returns:int

the offset of the composition

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getRangesback to summary
public int[] getRanges()

Returns the ranges for the style that should be applied during the in-line edit session.

The ranges array contains start and end pairs. Each pair refers to the corresponding style in the styles array. For example, the pair that starts at ranges[n] and ends at ranges[n+1] uses the style at styles[n/2] returned by getStyles().

Returns:int[]

the ranges for the styles

Exceptions
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
IME#getStyles
getStylesback to summary
public TextStyle[] getStyles()

Returns the styles for the ranges.

The ranges array contains start and end pairs. Each pair refers to the corresponding style in the styles array. For example, the pair that starts at ranges[n] and ends at ranges[n+1] uses the style at styles[n/2].

Returns:TextStyle[]

the ranges for the styles

Exceptions
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
IME#getRanges
getTextback to summary
public String getText()

Returns the composition text.

The text for an IME is the characters in the widget that are in the current composition. When the commit count is equal to the length of the composition text, then the in-line edit operation is complete.

Returns:String

the widget text

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getWideCaretback to summary
public boolean getWideCaret()

Returns true if the caret should be wide, and false otherwise. In some languages, for example Korean, the caret is typically widened to the width of the current character in the in-line edit session.

Returns:boolean

the wide caret state

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
gtk_button_press_eventback to summary
pack-priv long gtk_button_press_event(long widget, long event)

Overrides org.eclipse.swt.widgets.Widget.gtk_button_press_event.

Annotations
@Override
gtk_commitback to summary
pack-priv long gtk_commit(long imcontext, long textPtr)

Overrides org.eclipse.swt.widgets.Widget.gtk_commit.

Annotations
@Override
gtk_preedit_changedback to summary
pack-priv long gtk_preedit_changed(long imcontext)

Overrides org.eclipse.swt.widgets.Widget.gtk_preedit_changed.

Annotations
@Override
imHandleback to summary
pack-priv long imHandle()
isInlineEnabledback to summary
pack-priv boolean isInlineEnabled()
releaseParentback to summary
pack-priv void releaseParent()

Overrides org.eclipse.swt.widgets.Widget.releaseParent.

Annotations
@Override
releaseWidgetback to summary
pack-priv void releaseWidget()

Overrides org.eclipse.swt.widgets.Widget.releaseWidget.

Annotations
@Override
setCompositionOffsetback to summary
public void setCompositionOffset(int offset)

Sets the offset of the composition from the start of the document. This is the start offset of the composition within the document and in not changed by the input method editor itself during the in-line edit session but may need to be changed by clients of the IME. For example, if during an in-line edit operation, a text editor inserts characters above the IME, then the IME must be informed that the composition offset has changed.

Parameters
offset:int

the offset of the composition

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver