Class FxCaret
public class FxCaret implements TimerListener
{
// Constructors
public FxCaret(Component c, int w, int h);
public FxCaret(IUIComponent c, int w, int h);
// Methods
public int getHeight();
public int getWidth();
public void hide();
public boolean isVisible();
public void setInputMethod( InputMethodListener ime );
public void setPos(Point p);
public void setPos(int px, int py);
public void show();
public void timeTriggered(TimerEvent te);
}
This is a cross-platform class that manages a caret object.
The caret can also connect to an Input Method Editor (IME). Use the setInputMethod method to associate an InputMethodListener object with the FxCaret object. When you call the show and setPos methods, the IME's composition window is displayed.
public FxCaret(Component c, int w, int h);
Creates a caret and links it to a java.awt Component. Initially, the caret object is invisible.
Parameter | Description |
c
| The component where the caret should be displayed. This is passed to the setVisibleComponent method, and the font used in this component is passed to the setFont method. The attached IME then uses the component's font, and the composition window appears in a position near the caret.
|
w
| The width of the caret (in pixels).
|
h
| The height of the caret (in pixels).
|
public FxCaret(IUIComponent c, int w, int h);
Creates a caret and links it to a com.ms.ui.IUIComponent. Initially, the caret object is invisible.
Parameter | Description |
c
| The component where the caret is displayed. This is passed to the setVisibleComponent method, and the font used in this component is passed to the setFont method. The attached IME then uses the component's font, and the composition window appears in a position near the caret.
|
w
| The width of the caret (in pixels).
|
h
| The height of the caret (in pixels).
|
public int getHeight();
Retrieves the current height of the caret.
Return Value:
Returns the height of the caret (in pixels).
public int getWidth();
Retrieves the current width of the caret.
Return Value:
Returns the width of the caret (in pixels).
public void hide();
Hides the caret, if it is visible.
Return Value:
No return value.
public boolean isVisible();
Retrieves the visible state of the caret.
Return Value:
Returns true if the caret is visible; otherwise, returns false.
public void setInputMethod( InputMethodListener ime );
Sets the InputMethodListener for an FxCaret object. The FxCaret displays the composition window of the InputMethodListener near the caret.
Return Value:
No return value.
Parameter | Description |
ime
| the InputMethodListener to be set.
|
Remarks:
You must set an InputMethodListener before you call the show method. The font of the composition window is dependent on the attached component.
public void setPos(Point p);
Sets the caret position, relative to the owning component's upper-left corner.
Return Value:
No return value.
Parameter | Description |
p
| The Point that defines the caret's position.
|
public void setPos(int px, int py);
Sets the caret position, relative to the owning component's upper-left corner.
Return Value:
No return value.
Parameter | Description |
px
| The x coordinate for the caret.
|
py
| The y coordinate for the caret.
|
public void show();
Displays the caret, if it is not already visible. The caret can be active in only one component at a time.
Return Value:
No return value.
public void timeTriggered(TimerEvent te);
This method is called when a timer linked to the caret has expired.
Return Value:
No return value.
Parameter | Description |
te
| A TimerEvent that describes the event.
|