001: /*
002: * Portions Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: /*
027: * @(#)ThaiInputMethodDescriptor.java 1.12 07/05/05
028: *
029: * (C) Copyright IBM Corp. 2000 - All Rights Reserved
030: *
031: * The original version of this source code and documentation is
032: * copyrighted and owned by IBM. These materials are provided
033: * under terms of a License Agreement between IBM and Sun.
034: * This technology is protected by multiple US and International
035: * patents. This notice and attribution to IBM may not be removed.
036: *
037: */
038:
039: package com.sun.inputmethods.internal.thaiim;
040:
041: import java.awt.Image;
042: import java.awt.im.spi.InputMethod;
043: import java.awt.im.spi.InputMethodDescriptor;
044: import java.util.Locale;
045: import java.util.MissingResourceException;
046: import java.util.ResourceBundle;
047:
048: public class ThaiInputMethodDescriptor implements InputMethodDescriptor {
049:
050: static final Locale THAI = new Locale("th");
051:
052: public ThaiInputMethodDescriptor() {
053: }
054:
055: /**
056: * @see java.awt.im.spi.InputMethodDescriptor#getAvailableLocales
057: */
058: public Locale[] getAvailableLocales() {
059: return new Locale[] { THAI };
060: }
061:
062: /**
063: * @see java.awt.im.spi.InputMethodDescriptor#hasDynamicLocaleList
064: */
065: public boolean hasDynamicLocaleList() {
066: return false;
067: }
068:
069: /**
070: * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodDisplayName
071: */
072: public synchronized String getInputMethodDisplayName(
073: Locale inputLocale, Locale displayLanguage) {
074: try {
075: ResourceBundle resources = ResourceBundle
076: .getBundle(
077: "com.sun.inputmethods.internal.thaiim.resources.DisplayNames",
078: displayLanguage);
079: return resources.getString("DisplayName.Thai");
080: } catch (MissingResourceException mre) {
081: return "Thai Input Method";
082: }
083: }
084:
085: /**
086: * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodIcon
087: */
088: public Image getInputMethodIcon(Locale inputLocale) {
089: return null;
090: }
091:
092: /**
093: * @see java.awt.im.spi.InputMethodDescriptor#createInputMethod
094: */
095: public InputMethod createInputMethod() throws Exception {
096: ThaiInputMethodImpl impl = new ThaiInputMethodImpl();
097: return new ThaiInputMethod(THAI, impl);
098: }
099:
100: public String toString() {
101: return getClass().getName();
102: }
103: }
|