APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.awt.im

public final Class CompositionArea

extends JPanel
implements InputMethodListener
Class Inheritance
All Implemented Interfaces
java.awt.event.InputMethodListener, java.util.EventListener
Imports
java.awt.AWTEvent, .Color, .Dimension, .FontMetrics, .Graphics, .Graphics2D, .Point, .Rectangle, .Toolkit, java.awt.event.InputMethodEvent, .InputMethodListener, .WindowAdapter, .WindowEvent, java.awt.font.FontRenderContext, .TextHitInfo, .TextLayout, java.awt.geom.Rectangle2D, java.awt.im.InputMethodRequests, java.io.Serial, java.text.AttributedCharacterIterator, javax.swing.JFrame, .JPanel, javax.swing.border.LineBorder

A composition area is used to display text that's being composed using an input method in its own user interface environment, typically in a root window.
Author
JavaSoft International

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
private TextHitInfo
private TextLayout
private JFrame
private CompositionAreaHandler
private static final int
private static final int
private static final long
serialVersionUID

Hides java.awt.Container.serialVersionUID.

Use serialVersionUID from JDK 1.7 for interoperability.
private static final int
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
caretPositionChanged(InputMethodEvent event)

Implements java.awt.event.InputMethodListener.caretPositionChanged.

Invoked when the caret within composed text has changed.

private Rectangle
public InputMethodRequests
getInputMethodRequests()

Overrides java.awt.Component.getInputMethodRequests.

Gets the input method request handler which supports requests from input methods for this component.

pack-priv TextHitInfo
getLocationOffset(int x, int y)

pack-priv Rectangle
public void
inputMethodTextChanged(InputMethodEvent event)

Implements java.awt.event.InputMethodListener.inputMethodTextChanged.

Invoked when the text entered through an input method has changed.

pack-priv boolean
public void
paint(Graphics g)

Overrides javax.swing.JComponent.paint.

Invoked by Swing to draw components.

pack-priv void
setCaret(TextHitInfo caret)

Sets the caret to be displayed in this composition area.

pack-priv void
setCompositionAreaUndecorated(boolean setUndecorated)

pack-priv void
setCompositionAreaVisible(boolean visible)

pack-priv synchronized void
setHandlerInfo(CompositionAreaHandler handler, InputContext inputContext)

Sets the composition area handler that currently owns this composition area, and its input context.

pack-priv void
setText(AttributedCharacterIterator composedText, TextHitInfo caret)

Sets the text and caret to be displayed in this composition area.

pack-priv void
updateWindowLocation()

Positions the composition window near (usually below) the insertion point in the client component if the client component is an active client (below-the-spot input).

Inherited from javax.swing.JPanel:
getAccessibleContextgetUIgetUIClassIDparamStringsetUIupdateUI

Field Detail

caretback to summary
private TextHitInfo caret
Annotations
@SuppressWarnings:serial
composedTextLayoutback to summary
private TextLayout composedTextLayout
Annotations
@SuppressWarnings:serial
compositionWindowback to summary
private JFrame compositionWindow
handlerback to summary
private CompositionAreaHandler handler
Annotations
@SuppressWarnings:serial
HEIGHT_MARGINback to summary
private static final int HEIGHT_MARGIN
PASSIVE_WIDTHback to summary
private static final int PASSIVE_WIDTH
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.awt.Container.serialVersionUID.

Use serialVersionUID from JDK 1.7 for interoperability.

Annotations
@Serial
TEXT_ORIGIN_Xback to summary
private static final int TEXT_ORIGIN_X
TEXT_ORIGIN_Yback to summary
private static final int TEXT_ORIGIN_Y
WIDTH_MARGINback to summary
private static final int WIDTH_MARGIN

Constructor Detail

CompositionAreaback to summary
pack-priv CompositionArea()

Method Detail

caretPositionChangedback to summary
public void caretPositionChanged(InputMethodEvent event)

Implements java.awt.event.InputMethodListener.caretPositionChanged.

Doc from java.awt.event.InputMethodListener.caretPositionChanged.

Invoked when the caret within composed text has changed.

getCaretRectangleback to summary
private Rectangle getCaretRectangle(TextHitInfo caret)
getInputMethodRequestsback to summary
public InputMethodRequests getInputMethodRequests()

Overrides java.awt.Component.getInputMethodRequests.

Doc from java.awt.Component.getInputMethodRequests.

Gets the input method request handler which supports requests from input methods for this component. A component that supports on-the-spot text input must override this method to return an InputMethodRequests instance. At the same time, it also has to handle input method events.

See Also
java.awt.Component#getInputMethodRequests
getLocationOffsetback to summary
pack-priv TextHitInfo getLocationOffset(int x, int y)
getTextLocationback to summary
pack-priv Rectangle getTextLocation(TextHitInfo offset)
inputMethodTextChangedback to summary
public void inputMethodTextChanged(InputMethodEvent event)

Implements java.awt.event.InputMethodListener.inputMethodTextChanged.

Doc from java.awt.event.InputMethodListener.inputMethodTextChanged.

Invoked when the text entered through an input method has changed.

isCompositionAreaVisibleback to summary
pack-priv boolean isCompositionAreaVisible()
paintback to summary
public void paint(Graphics g)

Overrides javax.swing.JComponent.paint.

Doc from javax.swing.JComponent.paint.

Invoked by Swing to draw components. Applications should not invoke paint directly, but should instead use the repaint method to schedule the component for redrawing.

This method actually delegates the work of painting to three protected methods: paintComponent, paintBorder, and paintChildren. They're called in the order listed to ensure that children appear on top of component itself. Generally speaking, the component and its children should not paint in the insets area allocated to the border. Subclasses can just override this method, as always. A subclass that just wants to specialize the UI (look and feel) delegate's paint method should just override paintComponent.

setCaretback to summary
pack-priv void setCaret(TextHitInfo caret)

Sets the caret to be displayed in this composition area. The text is not changed.

setCompositionAreaUndecoratedback to summary
pack-priv void setCompositionAreaUndecorated(boolean setUndecorated)
setCompositionAreaVisibleback to summary
pack-priv void setCompositionAreaVisible(boolean visible)
setHandlerInfoback to summary
pack-priv synchronized void setHandlerInfo(CompositionAreaHandler handler, InputContext inputContext)

Sets the composition area handler that currently owns this composition area, and its input context.

setTextback to summary
pack-priv void setText(AttributedCharacterIterator composedText, TextHitInfo caret)

Sets the text and caret to be displayed in this composition area. Shows the window if it contains text, hides it if not.

updateWindowLocationback to summary
pack-priv void updateWindowLocation()

Positions the composition window near (usually below) the insertion point in the client component if the client component is an active client (below-the-spot input).

sun.awt.im back to summary

pack-priv Class CompositionArea.FrameWindowAdapter

extends WindowAdapter
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
Inherited from java.awt.event.WindowAdapter:
windowClosedwindowClosingwindowDeactivatedwindowDeiconifiedwindowGainedFocuswindowIconifiedwindowLostFocuswindowOpenedwindowStateChanged

Constructor Detail

FrameWindowAdapterback to summary
pack-priv FrameWindowAdapter()

Method Detail

windowActivatedback to summary
public void windowActivated(WindowEvent e)

Overrides java.awt.event.WindowAdapter.windowActivated.

Implements java.awt.event.WindowListener.windowActivated.

Doc from java.awt.event.WindowAdapter.windowActivated.

Invoked when a window is activated.