< prev index next >

src/java.desktop/macosx/classes/sun/lwawt/macosx/CInputMethodDescriptor.java

Print this page


   1 /*
   2  * Copyright (c) 2011, 2017, 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


  89         }
  90         return name;
  91     }
  92 
  93     /**
  94         * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodIcon
  95      */
  96     public Image getInputMethodIcon(Locale inputLocale) {
  97         // This should return the flag icon corresponding to the input Locale.
  98         return null;
  99     }
 100 
 101     /**
 102         * @see java.awt.im.spi.InputMethodDescriptor#createInputMethod
 103      */
 104     public InputMethod createInputMethod() throws Exception {
 105         return new CInputMethod();
 106     }
 107 
 108     public String toString() {
 109         Locale loc[] = getAvailableLocales();
 110         String locnames = null;
 111 
 112         for (int i = 0; i < loc.length; i++) {
 113             if (locnames == null) {
 114                 locnames = loc[i].toString();
 115             } else {
 116                 locnames += "," + loc[i];
 117             }
 118         }
 119         return getClass().getName() + "[" +
 120             "locales=" + locnames +
 121             ",localelist=" + (hasDynamicLocaleList() ? "dynamic" : "static") +
 122             "]";
 123     }
 124 
 125     private static native void nativeInit();
 126     private static native List<Object> nativeGetAvailableLocales();
 127 }
   1 /*
   2  * Copyright (c) 2011, 2018, 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


  89         }
  90         return name;
  91     }
  92 
  93     /**
  94         * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodIcon
  95      */
  96     public Image getInputMethodIcon(Locale inputLocale) {
  97         // This should return the flag icon corresponding to the input Locale.
  98         return null;
  99     }
 100 
 101     /**
 102         * @see java.awt.im.spi.InputMethodDescriptor#createInputMethod
 103      */
 104     public InputMethod createInputMethod() throws Exception {
 105         return new CInputMethod();
 106     }
 107 
 108     public String toString() {
 109         Locale[] loc = getAvailableLocales();
 110         String locnames = null;
 111 
 112         for (int i = 0; i < loc.length; i++) {
 113             if (locnames == null) {
 114                 locnames = loc[i].toString();
 115             } else {
 116                 locnames += "," + loc[i];
 117             }
 118         }
 119         return getClass().getName() + "[" +
 120             "locales=" + locnames +
 121             ",localelist=" + (hasDynamicLocaleList() ? "dynamic" : "static") +
 122             "]";
 123     }
 124 
 125     private static native void nativeInit();
 126     private static native List<Object> nativeGetAvailableLocales();
 127 }
< prev index next >