クラス 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
オーバーライド:
クラス ComponentgetInputMethodRequests

setFontSize

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

getDisplayText

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

getCaret

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

inputMethodTextChanged

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

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

定義:
インタフェース InputMethodListenerinputMethodTextChanged

caretPositionChanged

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

getTextLocation

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

getLocationOffset

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

getInsertPositionOffset

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

getCommittedText

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

cancelLatestCommittedText

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

getSelectedText

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


Java、Java 2D、および JDBC は、米国およびその他の国における Sun Microsystems, Inc. の商標または登録商標です。All Rights Reserved.