jdk/src/share/classes/com/sun/inputmethods/internal/thaiim/ThaiInputMethodDescriptor.java
changeset 5656 4868963e05e0
parent 5655 8dacdb7bb25b
parent 5645 c98f230a6078
child 5657 7e406ebed9a5
equal deleted inserted replaced
5655:8dacdb7bb25b 5656:4868963e05e0
     1 /*
       
     2  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * questions.
       
    24  */
       
    25 
       
    26 /*
       
    27  *
       
    28  * (C) Copyright IBM Corp. 2000 - All Rights Reserved
       
    29  *
       
    30  * The original version of this source code and documentation is
       
    31  * copyrighted and owned by IBM. These materials are provided
       
    32  * under terms of a License Agreement between IBM and Sun.
       
    33  * This technology is protected by multiple US and International
       
    34  * patents. This notice and attribution to IBM may not be removed.
       
    35  *
       
    36  */
       
    37 
       
    38 package com.sun.inputmethods.internal.thaiim;
       
    39 
       
    40 import java.awt.Image;
       
    41 import java.awt.im.spi.InputMethod;
       
    42 import java.awt.im.spi.InputMethodDescriptor;
       
    43 import java.util.Locale;
       
    44 import java.util.MissingResourceException;
       
    45 import java.util.ResourceBundle;
       
    46 
       
    47 public class ThaiInputMethodDescriptor implements InputMethodDescriptor {
       
    48 
       
    49     static final Locale THAI = new Locale("th");
       
    50 
       
    51     public ThaiInputMethodDescriptor() {
       
    52     }
       
    53 
       
    54     /**
       
    55      * @see java.awt.im.spi.InputMethodDescriptor#getAvailableLocales
       
    56      */
       
    57     public Locale[] getAvailableLocales() {
       
    58         return new Locale[] { THAI };
       
    59     }
       
    60 
       
    61     /**
       
    62      * @see java.awt.im.spi.InputMethodDescriptor#hasDynamicLocaleList
       
    63      */
       
    64     public boolean hasDynamicLocaleList() {
       
    65         return false;
       
    66     }
       
    67 
       
    68     /**
       
    69      * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodDisplayName
       
    70      */
       
    71     public synchronized String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) {
       
    72         try {
       
    73             ResourceBundle resources = ResourceBundle.getBundle(
       
    74                 "com.sun.inputmethods.internal.thaiim.resources.DisplayNames", displayLanguage);
       
    75             return resources.getString("DisplayName.Thai");
       
    76         } catch (MissingResourceException mre) {
       
    77             return "Thai Input Method";
       
    78         }
       
    79     }
       
    80 
       
    81     /**
       
    82      * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodIcon
       
    83      */
       
    84     public Image getInputMethodIcon(Locale inputLocale) {
       
    85         return null;
       
    86     }
       
    87 
       
    88     /**
       
    89      * @see java.awt.im.spi.InputMethodDescriptor#createInputMethod
       
    90      */
       
    91     public InputMethod createInputMethod() throws Exception {
       
    92         ThaiInputMethodImpl impl = new ThaiInputMethodImpl();
       
    93         return new ThaiInputMethod(THAI, impl);
       
    94     }
       
    95 
       
    96     public String toString() {
       
    97         return getClass().getName();
       
    98     }
       
    99 }