java.awt.im.InputMethodHighlight Java Examples

The following examples show how to use java.awt.im.InputMethodHighlight. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: X11InputMethod.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @see java.awt.Toolkit#mapInputMethodHighlight
 */
public static Map mapInputMethodHighlight(InputMethodHighlight highlight) {
    int index;
    int state = highlight.getState();
    if (state == InputMethodHighlight.RAW_TEXT) {
        index = 0;
    } else if (state == InputMethodHighlight.CONVERTED_TEXT) {
        index = 2;
    } else {
        return null;
    }
    if (highlight.isSelected()) {
        index += 1;
    }
    return highlightStyles[index];
}
 
Example #2
Source File: X11InputMethod.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @see java.awt.Toolkit#mapInputMethodHighlight
 */
public static Map mapInputMethodHighlight(InputMethodHighlight highlight) {
    int index;
    int state = highlight.getState();
    if (state == InputMethodHighlight.RAW_TEXT) {
        index = 0;
    } else if (state == InputMethodHighlight.CONVERTED_TEXT) {
        index = 2;
    } else {
        return null;
    }
    if (highlight.isSelected()) {
        index += 1;
    }
    return highlightStyles[index];
}
 
Example #3
Source File: X11InputMethod.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @see java.awt.Toolkit#mapInputMethodHighlight
 */
public static Map mapInputMethodHighlight(InputMethodHighlight highlight) {
    int index;
    int state = highlight.getState();
    if (state == InputMethodHighlight.RAW_TEXT) {
        index = 0;
    } else if (state == InputMethodHighlight.CONVERTED_TEXT) {
        index = 2;
    } else {
        return null;
    }
    if (highlight.isSelected()) {
        index += 1;
    }
    return highlightStyles[index];
}
 
Example #4
Source File: WToolkit.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a style map for the input method highlight.
 */
@Override
public Map<java.awt.font.TextAttribute,?> mapInputMethodHighlight(
    InputMethodHighlight highlight)
{
    return WInputMethod.mapInputMethodHighlight(highlight);
}
 
Example #5
Source File: CodePointInputMethod.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Send the composed text to the client.
 */
private void sendComposedText() {
    AttributedString as = new AttributedString(buffer.toString());
    as.addAttribute(TextAttribute.INPUT_METHOD_HIGHLIGHT,
            InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT);
    context.dispatchInputMethodEvent(
            InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
            as.getIterator(), 0,
            TextHitInfo.leading(insertionPoint), null);
}
 
Example #6
Source File: CodePointInputMethod.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Send the composed text to the client.
 */
private void sendComposedText() {
    AttributedString as = new AttributedString(buffer.toString());
    as.addAttribute(TextAttribute.INPUT_METHOD_HIGHLIGHT,
            InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT);
    context.dispatchInputMethodEvent(
            InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
            as.getIterator(), 0,
            TextHitInfo.leading(insertionPoint), null);
}
 
Example #7
Source File: X11InputMethod.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performs mapping from an XIM visible feedback value to Java IM highlight.
 * @return Java input method highlight
 */
private InputMethodHighlight convertVisualFeedbackToHighlight(int feedback) {
    InputMethodHighlight highlight;

    switch (feedback) {
    case XIMUnderline:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMReverse:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMHighlight:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    case XIMPrimary:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMSecondary:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMTertiary:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    default:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    }
    return highlight;
}
 
Example #8
Source File: WToolkit.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a style map for the input method highlight.
 */
@Override
public Map<java.awt.font.TextAttribute,?> mapInputMethodHighlight(
    InputMethodHighlight highlight)
{
    return WInputMethod.mapInputMethodHighlight(highlight);
}
 
Example #9
Source File: X11InputMethod.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performs mapping from an XIM visible feedback value to Java IM highlight.
 * @return Java input method highlight
 */
private InputMethodHighlight convertVisualFeedbackToHighlight(int feedback) {
    InputMethodHighlight highlight;

    switch (feedback) {
    case XIMUnderline:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMReverse:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMHighlight:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    case XIMPrimary:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMSecondary:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMTertiary:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    default:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    }
    return highlight;
}
 
Example #10
Source File: WToolkit.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a style map for the input method highlight.
 */
@Override
public Map<java.awt.font.TextAttribute,?> mapInputMethodHighlight(
    InputMethodHighlight highlight)
{
    return WInputMethod.mapInputMethodHighlight(highlight);
}
 
Example #11
Source File: CodePointInputMethod.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Send the composed text to the client.
 */
private void sendComposedText() {
    AttributedString as = new AttributedString(buffer.toString());
    as.addAttribute(TextAttribute.INPUT_METHOD_HIGHLIGHT,
            InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT);
    context.dispatchInputMethodEvent(
            InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
            as.getIterator(), 0,
            TextHitInfo.leading(insertionPoint), null);
}
 
Example #12
Source File: WToolkit.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a style map for the input method highlight.
 */
@Override
public Map<java.awt.font.TextAttribute,?> mapInputMethodHighlight(
    InputMethodHighlight highlight)
{
    return WInputMethod.mapInputMethodHighlight(highlight);
}
 
Example #13
Source File: X11InputMethod.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performs mapping from an XIM visible feedback value to Java IM highlight.
 * @return Java input method highlight
 */
private InputMethodHighlight convertVisualFeedbackToHighlight(int feedback) {
    InputMethodHighlight highlight;

    switch (feedback) {
    case XIMUnderline:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMReverse:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMHighlight:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    case XIMPrimary:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMSecondary:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMTertiary:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    default:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    }
    return highlight;
}
 
Example #14
Source File: X11InputMethod.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performs mapping from an XIM visible feedback value to Java IM highlight.
 * @return Java input method highlight
 */
private InputMethodHighlight convertVisualFeedbackToHighlight(int feedback) {
    InputMethodHighlight highlight;

    switch (feedback) {
    case XIMUnderline:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMReverse:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMHighlight:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    case XIMPrimary:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMSecondary:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMTertiary:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    default:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    }
    return highlight;
}
 
Example #15
Source File: X11InputMethod.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performs mapping from an XIM visible feedback value to Java IM highlight.
 * @return Java input method highlight
 */
private InputMethodHighlight convertVisualFeedbackToHighlight(int feedback) {
    InputMethodHighlight highlight;

    switch (feedback) {
    case XIMUnderline:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMReverse:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMHighlight:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    case XIMPrimary:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMSecondary:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMTertiary:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    default:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    }
    return highlight;
}
 
Example #16
Source File: WToolkit.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a style map for the input method highlight.
 */
@Override
public Map<java.awt.font.TextAttribute,?> mapInputMethodHighlight(
    InputMethodHighlight highlight)
{
    return WInputMethod.mapInputMethodHighlight(highlight);
}
 
Example #17
Source File: WToolkit.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a style map for the input method highlight.
 */
@Override
public Map<java.awt.font.TextAttribute,?> mapInputMethodHighlight(
    InputMethodHighlight highlight)
{
    return WInputMethod.mapInputMethodHighlight(highlight);
}
 
Example #18
Source File: WToolkit.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a style map for the input method highlight.
 */
@Override
public Map<java.awt.font.TextAttribute,?> mapInputMethodHighlight(
    InputMethodHighlight highlight)
{
    return WInputMethod.mapInputMethodHighlight(highlight);
}
 
Example #19
Source File: CodePointInputMethod.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Send the composed text to the client.
 */
private void sendComposedText() {
    AttributedString as = new AttributedString(buffer.toString());
    as.addAttribute(TextAttribute.INPUT_METHOD_HIGHLIGHT,
            InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT);
    context.dispatchInputMethodEvent(
            InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
            as.getIterator(), 0,
            TextHitInfo.leading(insertionPoint), null);
}
 
Example #20
Source File: X11InputMethod.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performs mapping from an XIM visible feedback value to Java IM highlight.
 * @return Java input method highlight
 */
private InputMethodHighlight convertVisualFeedbackToHighlight(int feedback) {
    InputMethodHighlight highlight;

    switch (feedback) {
    case XIMUnderline:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMReverse:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMHighlight:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    case XIMPrimary:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMSecondary:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMTertiary:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    default:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    }
    return highlight;
}
 
Example #21
Source File: CodePointInputMethod.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Send the composed text to the client.
 */
private void sendComposedText() {
    AttributedString as = new AttributedString(buffer.toString());
    as.addAttribute(TextAttribute.INPUT_METHOD_HIGHLIGHT,
            InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT);
    context.dispatchInputMethodEvent(
            InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
            as.getIterator(), 0,
            TextHitInfo.leading(insertionPoint), null);
}
 
Example #22
Source File: X11InputMethod.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performs mapping from an XIM visible feedback value to Java IM highlight.
 * @return Java input method highlight
 */
private InputMethodHighlight convertVisualFeedbackToHighlight(int feedback) {
    InputMethodHighlight highlight;

    switch (feedback) {
    case XIMUnderline:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMReverse:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMHighlight:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    case XIMPrimary:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMSecondary:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMTertiary:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    default:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    }
    return highlight;
}
 
Example #23
Source File: X11InputMethod.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performs mapping from an XIM visible feedback value to Java IM highlight.
 * @return Java input method highlight
 */
private InputMethodHighlight convertVisualFeedbackToHighlight(int feedback) {
    InputMethodHighlight highlight;

    switch (feedback) {
    case XIMUnderline:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMReverse:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMHighlight:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    case XIMPrimary:
        highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMSecondary:
        highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
        break;
    case XIMTertiary:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    default:
        highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
        break;
    }
    return highlight;
}
 
Example #24
Source File: WToolkit.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a style map for the input method highlight.
 */
@Override
public Map<java.awt.font.TextAttribute,?> mapInputMethodHighlight(
    InputMethodHighlight highlight)
{
    return WInputMethod.mapInputMethodHighlight(highlight);
}
 
Example #25
Source File: HToolkit.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public Map mapInputMethodHighlight(InputMethodHighlight highlight)
    throws HeadlessException {
    throw new HeadlessException();
}
 
Example #26
Source File: HeadlessToolkit.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
@Override
public Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight)
    throws HeadlessException {
    throw new HeadlessException();
}
 
Example #27
Source File: ExceptionContract.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight) throws HeadlessException {
    return null;
}
 
Example #28
Source File: UtilitiesTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Map mapInputMethodHighlight(InputMethodHighlight highlight) throws HeadlessException {
    return Toolkit.getDefaultToolkit().mapInputMethodHighlight( highlight );
}
 
Example #29
Source File: bug7172833.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Map<TextAttribute, ?> mapInputMethodHighlight(
        final InputMethodHighlight highlight) throws HeadlessException {
    return null;
}
 
Example #30
Source File: HToolkit.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public Map mapInputMethodHighlight(InputMethodHighlight highlight)
    throws HeadlessException {
    throw new HeadlessException();
}