资源简介
java 输入法 制作
代码片段和文件信息
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
//usage: java -jar CantoInput.jar
//URL:http://www.linuxfans.org/nuke/modules.php?name=Site_Downloads&op=geninfo&did=4474
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
public class CantoInput extends KeyAdapter
implements ActionListener
{
public CantoInput()
{
punctuationMap = readDataFile(“punct.utf-8“);
tradSimpMap = readDataFile(“trad-simp.utf-8“);
romanMap = readDataFile(“roman.utf-8“);
}
private static HashMap readDataFile(String s)
{
HashMap hashmap = new HashMap();
StringBuffer buffer = new StringBuffer();
try
{
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader((CantoInput.class).getResourceAsStream(“/“ + s) “UTF-8“));
do
{
String s1;
if((s1 = bufferedreader.readLine()) == null)
break;
try
{
buffer.append(“ >“+s1);
StringTokenizer stringtokenizer = new StringTokenizer(s1);
String s2 = stringtokenizer.nextToken();
if(stringtokenizer.hasMoreTokens())
{
String s3 = stringtokenizer.nextToken(“\r\n“).trim();
if(hashmap.get(s2) != null)
{
String s4 = (String)hashmap.get(s2);
hashmap.put(s2 s4 + “ “ + s3);
} else
{
hashmap.put(s2 s3);
}
}
}
catch(Exception exception1) { }
} while(true);
}
catch(Exception exception)
{
System.out.println(“Exception caught while reading data file: “ + exception.getMessage());
}
codeBuffer=buffer.toString();
return hashmap;
}
public void keyPressed(KeyEvent keyevent)
{
if(!inInputMode)
return;
char c = Character.toLowerCase(keyevent.getKeyChar());
if(c == ‘\b‘)
{
String s = inputTextField.getText();
if(s != null && !s.equals(““))
keyevent.consume();
} else
if(c == ‘\n‘)
{
String s1 = inputTextField.getText();
if(s1 != null && !s1.equals(““))
keyevent.consume();
}
if(currentChoiceList != null)
{
if((keyevent.getKeyCode() == 34 || keyevent.getKeyCode() == 39 || keyevent.getKeyCode() == 40 || c == ‘=‘ || c == ‘+‘ || c == ‘.‘ || c == ‘>‘ || c == ‘]‘ || c == ‘}‘) && currentChoiceL
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 28631 2007-05-05 08:28 CantoInput.java
----------- --------- ---------- ----- ----
28631 1
评论
共有 条评论