<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_by_API%2Fjava.awt.im.spi%2FInputMethod</id>
		<title>Java by API/java.awt.im.spi/InputMethod - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_by_API%2Fjava.awt.im.spi%2FInputMethod"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_by_API/java.awt.im.spi/InputMethod&amp;action=history"/>
		<updated>2026-04-24T19:58:44Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_by_API/java.awt.im.spi/InputMethod&amp;diff=1741&amp;oldid=prev</id>
		<title> в 17:43, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_by_API/java.awt.im.spi/InputMethod&amp;diff=1741&amp;oldid=prev"/>
				<updated>2010-05-31T17:43:48Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 17:43, 31 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_by_API/java.awt.im.spi/InputMethod&amp;diff=1742&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_by_API/java.awt.im.spi/InputMethod&amp;diff=1742&amp;oldid=prev"/>
				<updated>2010-05-31T14:35:29Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== implements InputMethod ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
/*&lt;br /&gt;
 * @(#)CodePointInputMethod.java  1.6 05/11/17&lt;br /&gt;
 * &lt;br /&gt;
 * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without&lt;br /&gt;
 * modification, are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 * -Redistribution of source code must retain the above copyright notice, this&lt;br /&gt;
 *  list of conditions and the following disclaimer.&lt;br /&gt;
 * &lt;br /&gt;
 * -Redistribution in binary form must reproduce the above copyright notice, &lt;br /&gt;
 *  this list of conditions and the following disclaimer in the documentation&lt;br /&gt;
 *  and/or other materials provided with the distribution.&lt;br /&gt;
 * &lt;br /&gt;
 * Neither the name of Sun Microsystems, Inc. or the names of contributors may &lt;br /&gt;
 * be used to endorse or promote products derived from this software without &lt;br /&gt;
 * specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * This software is provided &amp;quot;AS IS,&amp;quot; without a warranty of any kind. ALL &lt;br /&gt;
 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING&lt;br /&gt;
 * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE&lt;br /&gt;
 * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. (&amp;quot;SUN&amp;quot;)&lt;br /&gt;
 * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE&lt;br /&gt;
 * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS&lt;br /&gt;
 * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST &lt;br /&gt;
 * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, &lt;br /&gt;
 * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY &lt;br /&gt;
 * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, &lt;br /&gt;
 * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.&lt;br /&gt;
 * &lt;br /&gt;
 * You acknowledge that this software is not designed, licensed or intended&lt;br /&gt;
 * for use in the design, construction, operation or maintenance of any&lt;br /&gt;
 * nuclear facility.&lt;br /&gt;
 */&lt;br /&gt;
/*&lt;br /&gt;
 * @(#)CodePointInputMethod.java  1.6 05/11/17&lt;br /&gt;
 */&lt;br /&gt;
//package com.sun.inputmethods.internal.codepointim;&lt;br /&gt;
import java.awt.AWTEvent;&lt;br /&gt;
import java.awt.Rectangle;&lt;br /&gt;
import java.awt.Toolkit;&lt;br /&gt;
import java.awt.event.InputMethodEvent;&lt;br /&gt;
import java.awt.event.KeyEvent;&lt;br /&gt;
import java.awt.font.TextAttribute;&lt;br /&gt;
import java.awt.font.TextHitInfo;&lt;br /&gt;
import java.awt.im.InputMethodHighlight;&lt;br /&gt;
import java.awt.im.spi.InputMethod;&lt;br /&gt;
import java.awt.im.spi.InputMethodContext;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.text.AttributedString;&lt;br /&gt;
import java.util.Locale;&lt;br /&gt;
/**&lt;br /&gt;
 * The Code Point Input Method is a simple input method that allows Unicode&lt;br /&gt;
 * characters to be entered using their code point or code unit values. See the&lt;br /&gt;
 * accompanying file README.txt for more information.&lt;br /&gt;
 *&lt;br /&gt;
 * @author Brian Beck&lt;br /&gt;
 */&lt;br /&gt;
public class CodePointInputMethod implements InputMethod {&lt;br /&gt;
    private static final int UNSET           = 0;&lt;br /&gt;
    private static final int ESCAPE          = 1; // \u0000       - \uFFFF&lt;br /&gt;
    private static final int SPECIAL_ESCAPE  = 2; // \U000000     - \U10FFFF&lt;br /&gt;
    private static final int SURROGATE_PAIR  = 3; // \uD800\uDC00 - \uDBFF\uDFFF&lt;br /&gt;
    private InputMethodContext context;&lt;br /&gt;
    private Locale locale;&lt;br /&gt;
    private StringBuffer buffer;&lt;br /&gt;
    private int insertionPoint;&lt;br /&gt;
    private int format = UNSET;&lt;br /&gt;
&lt;br /&gt;
    public CodePointInputMethod() throws IOException {&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * This is the input method&amp;quot;s main routine.  The composed text is stored&lt;br /&gt;
     * in buffer.&lt;br /&gt;
     */&lt;br /&gt;
    public void dispatchEvent(AWTEvent event) {&lt;br /&gt;
        // This input method handles KeyEvent only.&lt;br /&gt;
        if (!(event instanceof KeyEvent)) {&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        KeyEvent e = (KeyEvent) event;&lt;br /&gt;
        int eventID = event.getID();&lt;br /&gt;
        boolean notInCompositionMode = buffer.length() == 0;&lt;br /&gt;
        if (eventID == KeyEvent.KEY_PRESSED) {&lt;br /&gt;
            // If we are not in composition mode, pass through&lt;br /&gt;
            if (notInCompositionMode)  {&lt;br /&gt;
                return;&lt;br /&gt;
            }&lt;br /&gt;
            switch (e.getKeyCode()) {&lt;br /&gt;
                case KeyEvent.VK_LEFT:&lt;br /&gt;
                    moveCaretLeft();&lt;br /&gt;
                    break;&lt;br /&gt;
                case KeyEvent.VK_RIGHT:&lt;br /&gt;
                    moveCaretRight();&lt;br /&gt;
                    break;&lt;br /&gt;
            }&lt;br /&gt;
        } else if (eventID == KeyEvent.KEY_TYPED) {&lt;br /&gt;
            char c = e.getKeyChar();&lt;br /&gt;
            // If we are not in composition mode, wait a back slash&lt;br /&gt;
            if (notInCompositionMode)  {&lt;br /&gt;
                // If the type character is not a back slash, pass through&lt;br /&gt;
                if (c != &amp;quot;\\&amp;quot;) {&lt;br /&gt;
                    return;&lt;br /&gt;
                }&lt;br /&gt;
                startComposition(); // Enter to composition mode&lt;br /&gt;
            } else {&lt;br /&gt;
                switch (c) { &lt;br /&gt;
                case &amp;quot; &amp;quot;: // Exit from composition mode&lt;br /&gt;
                    finishComposition();&lt;br /&gt;
                    break;&lt;br /&gt;
                case &amp;quot;\u007f&amp;quot;:  // Delete&lt;br /&gt;
                    deleteCharacter();&lt;br /&gt;
                    break;&lt;br /&gt;
                case &amp;quot;\b&amp;quot;:  // BackSpace&lt;br /&gt;
                    deletePreviousCharacter();&lt;br /&gt;
                    break;&lt;br /&gt;
                case &amp;quot;\u001b&amp;quot;:  // Escape&lt;br /&gt;
                    cancelComposition();&lt;br /&gt;
                    break;&lt;br /&gt;
                case &amp;quot;\n&amp;quot;:  // Return&lt;br /&gt;
                case &amp;quot;\t&amp;quot;:  // Tab&lt;br /&gt;
                    sendCommittedText();&lt;br /&gt;
                    break;&lt;br /&gt;
                default:&lt;br /&gt;
                    composeUnicodeEscape(c);&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        } else {  // KeyEvent.KEY_RELEASED&lt;br /&gt;
            // If we are not in composition mode, pass through&lt;br /&gt;
            if (notInCompositionMode)  {&lt;br /&gt;
                return;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        e.consume();&lt;br /&gt;
    }&lt;br /&gt;
    private void composeUnicodeEscape(char c) {&lt;br /&gt;
        switch (buffer.length()) {&lt;br /&gt;
            case  1:  // \\&lt;br /&gt;
                waitEscapeCharacter(c);&lt;br /&gt;
                break;&lt;br /&gt;
            case 2:  // \\u or \\U&lt;br /&gt;
            case 3:  // \\ux or \\Ux&lt;br /&gt;
            case 4:  // \\uxx or \\Uxx&lt;br /&gt;
                waitDigit(c);&lt;br /&gt;
                break;&lt;br /&gt;
            case 5:  // \\uxxx or \\Uxxx&lt;br /&gt;
                if (format == SPECIAL_ESCAPE) {&lt;br /&gt;
                    waitDigit(c);&lt;br /&gt;
                } else {&lt;br /&gt;
                    waitDigit2(c);&lt;br /&gt;
                }&lt;br /&gt;
                break;&lt;br /&gt;
            case 6:  // \\uxxxx or \\Uxxxx&lt;br /&gt;
                if (format == SPECIAL_ESCAPE) {&lt;br /&gt;
                    waitDigit(c);&lt;br /&gt;
                } else if (format == SURROGATE_PAIR) {&lt;br /&gt;
                    waitBackSlashOrLowSurrogate(c);&lt;br /&gt;
                } else {&lt;br /&gt;
                    beep();&lt;br /&gt;
                }&lt;br /&gt;
                break;&lt;br /&gt;
            case 7:  // \\Uxxxxx&lt;br /&gt;
                // Only SPECIAL_ESCAPE format uses this state.&lt;br /&gt;
                // Since the second &amp;quot;\\u&amp;quot; of SURROGATE_PAIR format is inserted&lt;br /&gt;
                // automatically, users don&amp;quot;t have to type these keys.&lt;br /&gt;
                waitDigit(c);&lt;br /&gt;
                break;&lt;br /&gt;
            case 8:  // \\uxxxx\\u&lt;br /&gt;
            case 9:  // \\uxxxx\\ux&lt;br /&gt;
            case 10: // \\uxxxx\\uxx&lt;br /&gt;
            case 11: // \\uxxxx\\uxxx&lt;br /&gt;
                if (format == SURROGATE_PAIR) {&lt;br /&gt;
                    waitDigit(c);&lt;br /&gt;
                } else {&lt;br /&gt;
                    beep();&lt;br /&gt;
                }&lt;br /&gt;
                break;&lt;br /&gt;
            default:&lt;br /&gt;
                beep();&lt;br /&gt;
                break;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    private void waitEscapeCharacter(char c) {&lt;br /&gt;
        if (c == &amp;quot;u&amp;quot; || c == &amp;quot;U&amp;quot;) {&lt;br /&gt;
            buffer.append(c);&lt;br /&gt;
            insertionPoint++;&lt;br /&gt;
            sendComposedText();&lt;br /&gt;
            format = (c == &amp;quot;u&amp;quot;) ? ESCAPE : SPECIAL_ESCAPE;&lt;br /&gt;
        } else {&lt;br /&gt;
            if (c != &amp;quot;\\&amp;quot;) {&lt;br /&gt;
                buffer.append(c);&lt;br /&gt;
                insertionPoint++;&lt;br /&gt;
            }&lt;br /&gt;
            sendCommittedText();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    private void waitDigit(char c) {&lt;br /&gt;
        if (Character.digit(c, 16) != -1) {&lt;br /&gt;
            buffer.insert(insertionPoint++, c);&lt;br /&gt;
            sendComposedText();&lt;br /&gt;
        } else {&lt;br /&gt;
            beep();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    private void waitDigit2(char c) {&lt;br /&gt;
        if (Character.digit(c, 16) != -1) {&lt;br /&gt;
            buffer.insert(insertionPoint++, c);&lt;br /&gt;
            char codePoint = (char)getCodePoint(buffer, 2, 5);&lt;br /&gt;
            if (Character.isHighSurrogate(codePoint)) {&lt;br /&gt;
                format = SURROGATE_PAIR;&lt;br /&gt;
                buffer.append(&amp;quot;\\u&amp;quot;);&lt;br /&gt;
                insertionPoint = 8;&lt;br /&gt;
            } else {&lt;br /&gt;
                format = ESCAPE;&lt;br /&gt;
            }&lt;br /&gt;
            sendComposedText();&lt;br /&gt;
        } else {&lt;br /&gt;
            beep();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    private void waitBackSlashOrLowSurrogate(char c) {&lt;br /&gt;
        if (insertionPoint == 6) {&lt;br /&gt;
            if (c == &amp;quot;\\&amp;quot;) {&lt;br /&gt;
                buffer.append(c);&lt;br /&gt;
                buffer.append(&amp;quot;u&amp;quot;);&lt;br /&gt;
                insertionPoint = 8;&lt;br /&gt;
                sendComposedText();&lt;br /&gt;
            } else if (Character.digit(c, 16) != -1) {&lt;br /&gt;
                buffer.append(&amp;quot;\\u&amp;quot;);&lt;br /&gt;
                buffer.append(c);&lt;br /&gt;
                insertionPoint = 9;&lt;br /&gt;
                sendComposedText();&lt;br /&gt;
            } else {&lt;br /&gt;
                beep();&lt;br /&gt;
            }&lt;br /&gt;
        } else {&lt;br /&gt;
            beep();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Send the composed text to the client.&lt;br /&gt;
     */&lt;br /&gt;
    private void sendComposedText() {&lt;br /&gt;
        AttributedString as = new AttributedString(buffer.toString());&lt;br /&gt;
        as.addAttribute(TextAttribute.INPUT_METHOD_HIGHLIGHT,&lt;br /&gt;
                        InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT);&lt;br /&gt;
        context.dispatchInputMethodEvent(&lt;br /&gt;
                                  InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,&lt;br /&gt;
                                  as.getIterator(), 0,&lt;br /&gt;
                                  TextHitInfo.leading(insertionPoint), null);&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Send the committed text to the client.&lt;br /&gt;
     */&lt;br /&gt;
    private void sendCommittedText() {&lt;br /&gt;
        AttributedString as = new AttributedString(buffer.toString());&lt;br /&gt;
        context.dispatchInputMethodEvent(&lt;br /&gt;
                                  InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,&lt;br /&gt;
                                  as.getIterator(), buffer.length(),&lt;br /&gt;
                                  TextHitInfo.leading(insertionPoint), null);&lt;br /&gt;
        buffer.setLength(0);&lt;br /&gt;
        insertionPoint = 0;&lt;br /&gt;
        format = UNSET;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Move the insertion point one position to the left in the composed text.&lt;br /&gt;
     * Do not let the caret move to the left of the &amp;quot;\\u&amp;quot; or &amp;quot;\\U&amp;quot;.&lt;br /&gt;
     */&lt;br /&gt;
    private void moveCaretLeft() {&lt;br /&gt;
        int len = buffer.length();&lt;br /&gt;
        if (--insertionPoint &amp;lt; 2) {&lt;br /&gt;
            insertionPoint++;&lt;br /&gt;
            beep();&lt;br /&gt;
        } else if (format == SURROGATE_PAIR &amp;amp;&amp;amp; insertionPoint == 7) {&lt;br /&gt;
            insertionPoint = 8;&lt;br /&gt;
            beep();&lt;br /&gt;
        }&lt;br /&gt;
        context.dispatchInputMethodEvent(&lt;br /&gt;
                                  InputMethodEvent.CARET_POSITION_CHANGED,&lt;br /&gt;
                                  null, 0,&lt;br /&gt;
                                  TextHitInfo.leading(insertionPoint), null);&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Move the insertion point one position to the right in the composed text.&lt;br /&gt;
     */&lt;br /&gt;
    private void moveCaretRight() {&lt;br /&gt;
        int len = buffer.length();&lt;br /&gt;
        if (++insertionPoint &amp;gt; len) {&lt;br /&gt;
            insertionPoint = len;&lt;br /&gt;
            beep();&lt;br /&gt;
        }&lt;br /&gt;
        context.dispatchInputMethodEvent(&lt;br /&gt;
                                  InputMethodEvent.CARET_POSITION_CHANGED,&lt;br /&gt;
                                  null, 0,&lt;br /&gt;
                                  TextHitInfo.leading(insertionPoint), null);&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Delete the character preceding the insertion point in the composed text.&lt;br /&gt;
     * If the insertion point is not at the end of the composed text and the&lt;br /&gt;
     * preceding text is &amp;quot;\\u&amp;quot; or &amp;quot;\\U&amp;quot;, ring the bell.&lt;br /&gt;
     */&lt;br /&gt;
    private void deletePreviousCharacter() {&lt;br /&gt;
        if (insertionPoint == 2) {&lt;br /&gt;
            if (buffer.length() == 2) {&lt;br /&gt;
                cancelComposition();&lt;br /&gt;
            } else {&lt;br /&gt;
                // Do not allow deletion of the leading &amp;quot;\\u&amp;quot; or &amp;quot;\\U&amp;quot; if there&lt;br /&gt;
                // are other digits in the composed text.&lt;br /&gt;
                beep();&lt;br /&gt;
            }&lt;br /&gt;
        } else if (insertionPoint == 8) {&lt;br /&gt;
            if (buffer.length() == 8) {&lt;br /&gt;
                if (format == SURROGATE_PAIR) {&lt;br /&gt;
                    buffer.deleteCharAt(--insertionPoint);&lt;br /&gt;
                }&lt;br /&gt;
                buffer.deleteCharAt(--insertionPoint);&lt;br /&gt;
                sendComposedText();&lt;br /&gt;
            } else {&lt;br /&gt;
                // Do not allow deletion of the second &amp;quot;\\u&amp;quot; if there are other&lt;br /&gt;
                // digits in the composed text.&lt;br /&gt;
                beep();&lt;br /&gt;
            }&lt;br /&gt;
        } else {&lt;br /&gt;
            buffer.deleteCharAt(--insertionPoint);&lt;br /&gt;
            if (buffer.length() == 0) {&lt;br /&gt;
                sendCommittedText();&lt;br /&gt;
            } else {&lt;br /&gt;
                sendComposedText();&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Delete the character following the insertion point in the composed text.&lt;br /&gt;
     * If the insertion point is at the end of the composed text, ring the bell.&lt;br /&gt;
     */&lt;br /&gt;
    private void deleteCharacter() {&lt;br /&gt;
        if (insertionPoint &amp;lt; buffer.length()) {&lt;br /&gt;
            buffer.deleteCharAt(insertionPoint);&lt;br /&gt;
            sendComposedText();&lt;br /&gt;
        } else {&lt;br /&gt;
            beep();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    private void startComposition() {&lt;br /&gt;
        buffer.append(&amp;quot;\\&amp;quot;);&lt;br /&gt;
        insertionPoint = 1;&lt;br /&gt;
        sendComposedText();&lt;br /&gt;
    }&lt;br /&gt;
    private void cancelComposition() {&lt;br /&gt;
        buffer.setLength(0);&lt;br /&gt;
        insertionPoint = 0;&lt;br /&gt;
        sendCommittedText();&lt;br /&gt;
    }&lt;br /&gt;
    private void finishComposition() {&lt;br /&gt;
        int len = buffer.length();&lt;br /&gt;
        if (len == 6 &amp;amp;&amp;amp; format != SPECIAL_ESCAPE) {&lt;br /&gt;
            char codePoint = (char)getCodePoint(buffer, 2, 5);&lt;br /&gt;
            if (Character.isValidCodePoint(codePoint) &amp;amp;&amp;amp; codePoint != 0xFFFF) {&lt;br /&gt;
                buffer.setLength(0);&lt;br /&gt;
                buffer.append(codePoint);&lt;br /&gt;
          sendCommittedText();&lt;br /&gt;
                return;&lt;br /&gt;
            }&lt;br /&gt;
        } else if (len == 8 &amp;amp;&amp;amp; format == SPECIAL_ESCAPE) {&lt;br /&gt;
            int codePoint = getCodePoint(buffer, 2, 7);&lt;br /&gt;
            if (Character.isValidCodePoint(codePoint) &amp;amp;&amp;amp; codePoint != 0xFFFF) {&lt;br /&gt;
                buffer.setLength(0);&lt;br /&gt;
                buffer.appendCodePoint(codePoint);&lt;br /&gt;
          sendCommittedText();&lt;br /&gt;
                return;&lt;br /&gt;
            }&lt;br /&gt;
        } else if (len == 12 &amp;amp;&amp;amp; format == SURROGATE_PAIR) {&lt;br /&gt;
      char[] codePoint = {&lt;br /&gt;
                (char)getCodePoint(buffer, 2, 5),&lt;br /&gt;
          (char)getCodePoint(buffer, 8, 11)&lt;br /&gt;
            };&lt;br /&gt;
            if (Character.isHighSurrogate(codePoint[0]) &amp;amp;&amp;amp;&lt;br /&gt;
                Character.isLowSurrogate(codePoint[1])) {&lt;br /&gt;
          buffer.setLength(0);&lt;br /&gt;
          buffer.append(codePoint);&lt;br /&gt;
          sendCommittedText();&lt;br /&gt;
                return;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        beep();&lt;br /&gt;
    }&lt;br /&gt;
    private int getCodePoint(StringBuffer sb, int from, int to) {&lt;br /&gt;
        int value = 0;&lt;br /&gt;
        for (int i = from; i &amp;lt;= to; i++) {&lt;br /&gt;
            value = (value&amp;lt;&amp;lt;4) + Character.digit(sb.charAt(i), 16);&lt;br /&gt;
        }&lt;br /&gt;
        return value;&lt;br /&gt;
    }&lt;br /&gt;
    private static void beep() {&lt;br /&gt;
        Toolkit.getDefaultToolkit().beep();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void activate() {&lt;br /&gt;
        if (buffer == null) {&lt;br /&gt;
            buffer = new StringBuffer(12);&lt;br /&gt;
            insertionPoint = 0;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public void deactivate(boolean isTemporary) {&lt;br /&gt;
        if (!isTemporary) {&lt;br /&gt;
            buffer = null;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public void dispose() {&lt;br /&gt;
    }&lt;br /&gt;
    public Object getControlObject() {&lt;br /&gt;
        return null;&lt;br /&gt;
    }&lt;br /&gt;
    public void endComposition() {&lt;br /&gt;
        sendCommittedText();&lt;br /&gt;
    }&lt;br /&gt;
    public Locale getLocale() {&lt;br /&gt;
        return locale;&lt;br /&gt;
    }&lt;br /&gt;
    public void hideWindows() {&lt;br /&gt;
    }&lt;br /&gt;
    public boolean isCompositionEnabled() {&lt;br /&gt;
        // always enabled&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
    public void notifyClientWindowChange(Rectangle location) {&lt;br /&gt;
    }&lt;br /&gt;
    public void reconvert() {&lt;br /&gt;
        // not supported yet&lt;br /&gt;
        throw new UnsupportedOperationException();&lt;br /&gt;
    }&lt;br /&gt;
    public void removeNotify() {&lt;br /&gt;
    }&lt;br /&gt;
    public void setCharacterSubsets(Character.Subset[] subsets) {&lt;br /&gt;
    }&lt;br /&gt;
    public void setCompositionEnabled(boolean enable) {&lt;br /&gt;
        // not supported yet&lt;br /&gt;
        throw new UnsupportedOperationException();&lt;br /&gt;
    }&lt;br /&gt;
    public void setInputMethodContext(InputMethodContext context) {&lt;br /&gt;
        this.context = context;&lt;br /&gt;
    }&lt;br /&gt;
    /*&lt;br /&gt;
     * The Code Point Input Method supports all locales.&lt;br /&gt;
     */&lt;br /&gt;
    public boolean setLocale(Locale locale) {&lt;br /&gt;
        this.locale = locale;&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>