Java Code Examples for java.awt.im.InputMethodHighlight

The following are top voted examples for showing how to use java.awt.im.InputMethodHighlight. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: incubator-netbeans   File: ComposedTextHighlighting.java   View source code 6 votes vote down vote up
private AttributeSet translateAttributes(Map<AttributedCharacterIterator.Attribute, ?> source) {
    for(AttributedCharacterIterator.Attribute sourceKey : source.keySet()) {
        Object sourceValue = source.get(sourceKey);
        
        // Ignore any non-input method related highlights
        if (!(sourceValue instanceof InputMethodHighlight)) {
            continue;
        }
        
        InputMethodHighlight imh = (InputMethodHighlight) sourceValue;
        
        if (imh.isSelected()) {
            return highlightInverse;
        } else {
            return highlightUnderlined;
        }
    }
    
    LOG.fine("No translation for " + source);
    return SimpleAttributeSet.EMPTY;
}
 
Example 2
Project: OpenJSharp   File: X11InputMethod.java   View source code 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
Project: jdk8u-jdk   File: X11InputMethod.java   View source code 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
Project: openjdk-jdk10   File: X11InputMethod.java   View source code 6 votes vote down vote up
/**
 * @see java.awt.Toolkit#mapInputMethodHighlight
 */
public static Map<TextAttribute, ?> 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 5
Project: openjdk9   File: X11InputMethod.java   View source code 6 votes vote down vote up
/**
 * @see java.awt.Toolkit#mapInputMethodHighlight
 */
public static Map<TextAttribute, ?> 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 6
Project: jdk8u_jdk   File: X11InputMethod.java   View source code 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 7
Project: lookaside_java-1.8.0-openjdk   File: X11InputMethod.java   View source code 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 8
Project: infobip-open-jdk-8   File: X11InputMethod.java   View source code 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 9
Project: jdk8u-dev-jdk   File: X11InputMethod.java   View source code 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 10
Project: jdk7-jdk   File: X11InputMethod.java   View source code 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 11
Project: openjdk-source-code-learn   File: X11InputMethod.java   View source code 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 12
Project: OLD-OpenJDK8   File: X11InputMethod.java   View source code 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 13
Project: cn1   File: LinuxSystemProperties.java   View source code 6 votes vote down vote up
public void mapInputMethodHighlight(InputMethodHighlight highlight, Map map) {
    TextAttribute key = TextAttribute.SWAP_COLORS;
    if (highlight.isSelected()) {
        map.put(key, TextAttribute.SWAP_COLORS_ON);
        return;
    }
    switch(highlight.getState()) {
    case InputMethodHighlight.RAW_TEXT:
        key = TextAttribute.WEIGHT;
        map.put(key, TextAttribute.WEIGHT_BOLD);
        break;
    case InputMethodHighlight.CONVERTED_TEXT:
        key = TextAttribute.INPUT_METHOD_UNDERLINE;
        map.put(key, TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
        break;
    }
}
 
Example 14
Project: cn1   File: WinSystemProperties.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
public void mapInputMethodHighlight(InputMethodHighlight highlight, Map<TextAttribute, ?> map) {
    Map<TextAttribute, Object> _map = (Map<TextAttribute, Object>)map;
    TextAttribute key = TextAttribute.INPUT_METHOD_UNDERLINE;
    boolean selected = highlight.isSelected();
    switch(highlight.getState()) {
    case InputMethodHighlight.RAW_TEXT:
        _map.put(key, selected ? TextAttribute.UNDERLINE_LOW_GRAY :
            TextAttribute.UNDERLINE_LOW_DOTTED);
        break;
    case InputMethodHighlight.CONVERTED_TEXT:
        _map.put(key, selected ? TextAttribute.UNDERLINE_LOW_ONE_PIXEL :
            TextAttribute.UNDERLINE_LOW_DOTTED);
        if (selected) {
            // maybe get colors from system properties?
            key = TextAttribute.BACKGROUND;
            _map.put(key, Color.white);
            key = TextAttribute.FOREGROUND;
            _map.put(key, new Color(0, 0, 128));
            key = TextAttribute.SWAP_COLORS;
            _map.put(key, TextAttribute.SWAP_COLORS_ON);
        }
        break;
    }
}
 
Example 15
Project: openjdk-jdk7u-jdk   File: X11InputMethod.java   View source code 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 16
Project: freeVM   File: LinuxSystemProperties.java   View source code 6 votes vote down vote up
public void mapInputMethodHighlight(InputMethodHighlight highlight, Map map) {
    TextAttribute key = TextAttribute.SWAP_COLORS;
    if (highlight.isSelected()) {
        map.put(key, TextAttribute.SWAP_COLORS_ON);
        return;
    }
    switch(highlight.getState()) {
    case InputMethodHighlight.RAW_TEXT:
        key = TextAttribute.WEIGHT;
        map.put(key, TextAttribute.WEIGHT_BOLD);
        break;
    case InputMethodHighlight.CONVERTED_TEXT:
        key = TextAttribute.INPUT_METHOD_UNDERLINE;
        map.put(key, TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
        break;
    }
}
 
Example 17
Project: freeVM   File: WinSystemProperties.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
public void mapInputMethodHighlight(InputMethodHighlight highlight, Map<TextAttribute, ?> map) {
    Map<TextAttribute, Object> _map = (Map<TextAttribute, Object>)map;
    TextAttribute key = TextAttribute.INPUT_METHOD_UNDERLINE;
    boolean selected = highlight.isSelected();
    switch(highlight.getState()) {
    case InputMethodHighlight.RAW_TEXT:
        _map.put(key, selected ? TextAttribute.UNDERLINE_LOW_GRAY :
            TextAttribute.UNDERLINE_LOW_DOTTED);
        break;
    case InputMethodHighlight.CONVERTED_TEXT:
        _map.put(key, selected ? TextAttribute.UNDERLINE_LOW_ONE_PIXEL :
            TextAttribute.UNDERLINE_LOW_DOTTED);
        if (selected) {
            // maybe get colors from system properties?
            key = TextAttribute.BACKGROUND;
            _map.put(key, Color.white);
            key = TextAttribute.FOREGROUND;
            _map.put(key, new Color(0, 0, 128));
            key = TextAttribute.SWAP_COLORS;
            _map.put(key, TextAttribute.SWAP_COLORS_ON);
        }
        break;
    }
}
 
Example 18
Project: freeVM   File: LinuxSystemProperties.java   View source code 6 votes vote down vote up
public void mapInputMethodHighlight(InputMethodHighlight highlight, Map map) {
    TextAttribute key = TextAttribute.SWAP_COLORS;
    if (highlight.isSelected()) {
        map.put(key, TextAttribute.SWAP_COLORS_ON);
        return;
    }
    switch(highlight.getState()) {
    case InputMethodHighlight.RAW_TEXT:
        key = TextAttribute.WEIGHT;
        map.put(key, TextAttribute.WEIGHT_BOLD);
        break;
    case InputMethodHighlight.CONVERTED_TEXT:
        key = TextAttribute.INPUT_METHOD_UNDERLINE;
        map.put(key, TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
        break;
    }
}
 
Example 19
Project: freeVM   File: WinSystemProperties.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
public void mapInputMethodHighlight(InputMethodHighlight highlight, Map<TextAttribute, ?> map) {
    Map<TextAttribute, Object> _map = (Map<TextAttribute, Object>)map;
    TextAttribute key = TextAttribute.INPUT_METHOD_UNDERLINE;
    boolean selected = highlight.isSelected();
    switch(highlight.getState()) {
    case InputMethodHighlight.RAW_TEXT:
        _map.put(key, selected ? TextAttribute.UNDERLINE_LOW_GRAY :
            TextAttribute.UNDERLINE_LOW_DOTTED);
        break;
    case InputMethodHighlight.CONVERTED_TEXT:
        _map.put(key, selected ? TextAttribute.UNDERLINE_LOW_ONE_PIXEL :
            TextAttribute.UNDERLINE_LOW_DOTTED);
        if (selected) {
            // maybe get colors from system properties?
            key = TextAttribute.BACKGROUND;
            _map.put(key, Color.white);
            key = TextAttribute.FOREGROUND;
            _map.put(key, new Color(0, 0, 128));
            key = TextAttribute.SWAP_COLORS;
            _map.put(key, TextAttribute.SWAP_COLORS_ON);
        }
        break;
    }
}
 
Example 20
Project: openjdk-icedtea7   File: X11InputMethod.java   View source code 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 21
Project: OpenJSharp   File: CodePointInputMethod.java   View source code 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
Project: OpenJSharp   File: WToolkit.java   View source code 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 23
Project: OpenJSharp   File: X11InputMethod.java   View source code 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
Project: jdk8u-jdk   File: CodePointInputMethod.java   View source code 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 25
Project: jdk8u-jdk   File: WToolkit.java   View source code 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 26
Project: jdk8u-jdk   File: X11InputMethod.java   View source code 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 27
Project: openjdk-jdk10   File: CodePointInputMethod.java   View source code 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 28
Project: openjdk-jdk10   File: X11InputMethod.java   View source code 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 29
Project: openjdk-jdk10   File: WToolkit.java   View source code 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 30
Project: openjdk9   File: CodePointInputMethod.java   View source code 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 31
Project: openjdk9   File: X11InputMethod.java   View source code 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 32
Project: openjdk9   File: WToolkit.java   View source code 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 33
Project: jdk8u_jdk   File: CodePointInputMethod.java   View source code 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 34
Project: jdk8u_jdk   File: WToolkit.java   View source code 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 35
Project: jdk8u_jdk   File: X11InputMethod.java   View source code 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 36
Project: lookaside_java-1.8.0-openjdk   File: CodePointInputMethod.java   View source code 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 37
Project: lookaside_java-1.8.0-openjdk   File: WToolkit.java   View source code 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 38
Project: lookaside_java-1.8.0-openjdk   File: X11InputMethod.java   View source code 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 39
Project: infobip-open-jdk-8   File: CodePointInputMethod.java   View source code 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 40
Project: infobip-open-jdk-8   File: WToolkit.java   View source code 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);
}