クラス ActiveClient

java.lang.Object
  |
  +--java.awt.Component
        |
        +--LWTextComponent
              |
              +--ActiveClient

public class ActiveClient
extends LWTextComponent
implements InputMethodListener, InputMethodRequests

統合テキスト入力ユーザインタフェースを実装します。 このクラスは、Input Method Framework のアクティブクライアントです。つまり、アクティブに API を使用して統合を実現します。

このクラスは、Input Method Framework の 2 つのクライアントインタフェース (InputMethodListener と InputMethodRequests) を直接実装します。 これは必須ではありません。 特に、public インターフェースが重要になる場合 (クラスライブラリ内など)、これらの 2 つのインタフェースを別のクラスに隠したほうがより適している場合があります。

関連項目:
直列化された形式

クラス java.awt.Component から継承されるフィールド
BOTTOM_ALIGNMENT、CENTER_ALIGNMENT、LEFT_ALIGNMENT、RIGHT_ALIGNMENT、TOP_ALIGNMENT
 
コンストラクタの概要
ActiveClient(String name)
ActiveClient を作成する
 
メソッドの概要
AttributedCharacterIterator cancelLatestCommittedText(AttributedCharacterIterator.Attribute[] attributes)
この単純なテキストコンポーネントで「確定取り消し」機能がサポートされないことを示すために null を返す
void caretPositionChanged(InputMethodEvent event)
変換テキスト内部のキャレットの変更を処理する
TextHitInfo getCaret()
現在のキャレット (挿入ポイント) を示すテキストヒット情報を返す
AttributedCharacterIterator getCommittedText(int beginIndex, int endIndex, AttributedCharacterIterator.Attribute[] attributes)
未確定のテキストを除く、テキスト編集コンポーネントに含まれるテキスト全体および属性へのアクセスを提供する反復子を取得する
AttributedCharacterIterator getDisplayText()
ユーザが入力したテキストを返す
InputMethodRequests getInputMethodRequests()
「this」を返して、ActiveClient の getInputMethodRequests を実装する
int getInsertPositionOffset()
テキスト編集コンポーネントに含まれる確定テキストの挿入位置のオフセットを取得する
TextHitInfo getLocationOffset(int x, int y)
画面上の指定された絶対 x 座標と絶対 y 座標に対する変換テキスト内のオフセットを取得する
AttributedCharacterIterator getSelectedText(AttributedCharacterIterator.Attribute[] attributes)
現在選択されているテキストをテキスト編集コンポーネントから取得する
Rectangle getTextLocation(TextHitInfo offset)
現在の変換テキスト内で指定されたオフセットの位置または確定テキスト内の選択の位置を取得する
void inputMethodTextChanged(InputMethodEvent event)
インプットメソッドによって入力されるテキストの変更を処理する
void setFontSize(int size)
新しいフォントサイズに合わせて変換テキストを調整する
 
クラス LWTextComponent から継承されるメソッド
focusGained、focusLost、getCaretRectangle、getCaretRectangle、getCommittedText、
getCommittedText、getCommittedTextLength、getTextLayout、getTextOrigin、
insertCharacter、invalidateTextLayout、keyPressed、keyReleased、keyTyped、paint
 
クラス java.awt.Component から継承されるメソッド
action、add、addComponentListener、addFocusListener、addInputMethodListener、
addKeyListener、addMouseListener、addMouseMotionListener、addNotify、
addPropertyChangeListener、addPropertyChangeListener、bounds、checkImage、
checkImage、coalesceEvents、contains、contains、createImage、createImage、
deliverEvent、disable、disableEvents、dispatchEvent、doLayout、enable、enable、
enableEvents、enableInputMethods、firePropertyChange、getAlignmentX、
getAlignmentY、getBackground、getBounds、getBounds、getColorModel、
getComponentAt、getComponentAt、getComponentOrientation、getCursor、
getDropTarget、getFont、getFontMetrics、getForeground、getGraphics、getHeight、
getInputContext、getLocale、getLocation、getLocation、getLocationOnScreen、
getMaximumSize、getMinimumSize、getName、getParent、getPeer、getPreferredSize、
getSize、getSize、getToolkit、getTreeLock、getWidth、getX、getY、gotFocus、
handleEvent、hasFocus、hide、imageUpdate、inside、invalidate、isDisplayable、
isDoubleBuffered、isEnabled、isFocusTraversable、isLightweight、isOpaque、
isShowing、isValid、isVisible、keyDown、keyUp、layout、list、list、list、list、
list、locate、location、lostFocus、minimumSize、mouseDown、mouseDrag、
mouseEnter、mouseExit、mouseMove、mouseUp、move、nextFocus、paintAll、
paramString、postEvent、preferredSize、prepareImage、prepareImage、print、
printAll、processComponentEvent、processEvent、processFocusEvent、
processInputMethodEvent、processKeyEvent、processMouseEvent、
processMouseMotionEvent、remove、removeComponentListener、removeFocusListener、
removeInputMethodListener、removeKeyListener、removeMouseListener、
removeMouseMotionListener、removeNotify、removePropertyChangeListener、
removePropertyChangeListener、repaint、repaint、repaint、repaint、requestFocus、
reshape、resize、resize、setBackground、setBounds、setBounds、
setComponentOrientation、setCursor、setDropTarget、setEnabled、setFont、
setForeground、setLocale、setLocation、setLocation、setName、setSize、setSize、
setVisible、show、show、size、toString、transferFocus、update、validate
 
クラス java.lang.Object から継承されるメソッド
clone、equals、finalize、getClass、hashCode、notify、notifyAll、wait、wait、wait
 

コンストラクタの詳細

ActiveClient

public ActiveClient(String name)
ActiveClient を作成します。 ActiveClient インスタンスのインプットメソッドは常に有効です。
パラメータ:
name - テキストの上に表示されるコンポーネント名
メソッドの詳細

getInputMethodRequests

public InputMethodRequests getInputMethodRequests()
「this」を返して、ActiveClient の getInputMethodRequests を実装します。
戻り値:
「this」
オーバーライド:
クラス Component の getInputMethodRequests

setFontSize

public void setFontSize(int size)
新しいフォントサイズに合わせて変換テキストを調整する
オーバーライド:
クラス LWTextComponent の setFontSize

getDisplayText

public AttributedCharacterIterator getDisplayText()
ユーザが入力したテキストを返します。 このオーバーライドは、確定テキストと変換テキストの連結を返します。
オーバーライド:
クラス LWTextComponent の getDisplayText

getCaret

public TextHitInfo getCaret()
現在のキャレット (挿入ポイント) を示すテキストヒット情報を返します。 このオーバーライドは、変換テキストが存在する場合はインプットメソッドによって提供されるキャレットを返します。変換テキストが存在しない場合は、確定 テキストの最後にキャレットを返します。 インプットメソッドによって提供されるキャレットが null の場合もあります。
オーバーライド:
クラス LWTextComponent の getCaret

inputMethodTextChanged

public void inputMethodTextChanged(InputMethodEvent event)
インプットメソッドによって入力されるテキストの変更を処理します。 イベントに含まれる確定テキストは、テキストコンポーネントの確定テキストに追加されます。 イベントに含まれる変換テキストは、テキストコンポーネントの既存の変換テキストを置き換えます。 イベントに定義されているキャレットは保存され、変換テキストが存在する場合は getCaret によってそのキャレットが返されます。 コンポーネントは、再描画されます。

この単純なコンポーネントでは、 インプットメソッドの反転表示属性だけを保持します。 より複雑なコンポーネントでは、言語、読み込み、インプットメソッドセグメントなどの属性も保持できます。

定義:
インタフェース InputMethodListener の inputMethodTextChanged

caretPositionChanged

public void caretPositionChanged(InputMethodEvent event)
変換テキスト内部のキャレットの変更を処理する イベントに定義されているキャレットは保存され、変換テキストが存在する場合は getCaret によってそのキャレットが返されます。 コンポーネントは、再描画されます。
定義:
インタフェース InputMethodListener の caretPositionChanged

getTextLocation

public Rectangle getTextLocation(TextHitInfo offset)
現在の変換テキスト内で指定されたオフセットの位置または確定テキスト内の選択の位置を取得します。
定義:
インタフェース InputMethodRequests の getTextLocation

getLocationOffset

public TextHitInfo getLocationOffset(int x,
int y)
画面上の指定された絶対 x 座標と絶対 y 座標に対する変換テキスト内のオフセットを取得します。
定義:
インタフェース InputMethodRequests の getLocationOffset

getInsertPositionOffset

public int getInsertPositionOffset()
テキスト編集コンポーネントに含まれる確定テキストの挿入位置のオフセットを取得します。 この単純なコンポーネントでは、オフセットは常に確定テキストの最後です。
定義:
インタフェース InputMethodRequests の getInsertPositionOffset

getCommittedText

public AttributedCharacterIterator getCommittedText(int beginIndex,
int endIndex,
AttributedCharacterIterator.Attribute[] attributes)
未確定のテキストを除く、テキスト編集コンポーネントに含まれるテキスト全体および属性へのアクセスを提供する反復子を取得します。
定義:
インタフェース InputMethodRequests の getCommittedText

cancelLatestCommittedText

public AttributedCharacterIterator cancelLatestCommittedText(AttributedCharacterIterator.Attribute[] attributes)
この単純なテキストコンポーネントで「確定取り消し」機能がサポートされないことを示すために null を返します。
定義:
インタフェース InputMethodRequests の cancelLatestCommittedText

getSelectedText

public AttributedCharacterIterator getSelectedText(AttributedCharacterIterator.Attribute[] attributes)
現在選択されているテキストをテキスト編集コンポーネントから取得します。 この単純なテキストコンポーネントでは、選択がサポートされていないため、これは常に空のテキストに対する反復子です。
定義:
インタフェース InputMethodRequests の getSelectedText



Java、Java 2D、および JDBC は、米国およびその他の国における Sun Microsystems, Inc. の商標または登録商標です。
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A.All Rights Reserved.