电字英汉词典java代码 java英语字典( 三 )


}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==btn1)//-------------------------------startsearch-------
{
String str="";
String tmp=this.txf.getText();
for(int k=0;ktmp.length();k++)
str+=tmp.charAt(k)+"%";
String sql=null;
Statement stmt=null;
sql="select * from chinese where charsound like'"+str+"'";
System.out.println(sql);
try{
Class.forName("com.mysql.jdbc.Driver");//或者:Class.forName("org.gjt.mm.mysql.Driver");
Connection conn=DriverManager.getConnection("jdbc:mysql://localhost/japan?user=rootpassword=sa");
stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery(sql);
System.out.println("\n------------------------search :"+str+"-------------------------------");
jt.setText("");
while(rs.next())
{
jt.append(new String(rs.getString("charname").getBytes("iso-8859-1"),"gb2312")+"\t");
System.out.print(new String(rs.getString("charname").getBytes("iso-8859-1"),"gb2312")+"\t");
}
stmt.close();
}
catch(Exception eq){System.out.println("error");}
//--------------------------------------------------------------end btn1-------
}
}
}
public class my
{
public static void main(String args[])
{
Mywindow win=new Mywindow();
win.pack();
}
}
Java程序设计电子英汉词典,帮忙根据我的程序写一个frame主类程序,在线等,急?。。?/h2>Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
Store store = session.getStore("pop3");
store.connect(host, username, password);
Folder folder = store.getFolder("INBOX");
folder.open(Folder.READ_ONLY);
FetchProfile profile = new FetchProfile();
profile.add(UIDFolder.FetchProfileItem.UID);
profile.add(FetchProfile.Item.ENVELOPE);
if (folder instanceof POP3Folder) {
POP3Folder inbox = (POP3Folder) folder;
Message message[] = inbox.getMessages();
System.out.println("Messages's length: " + message.length);
for (int i = 0; imessage.length; i++) {
MimeMessage mimeMessage = (MimeMessage) message[i];
String uid = inbox.getUID(mimeMessage);
System.out.println("uid=" + uid);
int UnreadMessageCount = inbox.getUnreadMessageCount();
System.out.println("UnreadMessageCount="+UnreadMessageCount);
int NewMessageCount = inbox.getNewMessageCount();
System.out.println("NewMessageCount="+NewMessageCount);
URLName urlName = inbox.getURLName();
System.out.println("urlName="+urlName);
}
}
}
构建英汉词典数据库 java*******************************************************************
假如InputDictionary.txt文件放在D盘根目录下,新建类Dictionary.java,代码如下:
*******************************************************************
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
public class Dictionary {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new FileReader(
"d:\\InputDictionary.txt"));
BufferedWriter bw = new BufferedWriter(new FileWriter(
"d:\\OutputDictionary.txt"));
String input, output;
while ((input = br.readLine()) != null) {
output = input.replaceAll(" +", "\t");
bw.append(output);
bw.newLine();
}
bw.flush();
bw.close();
br.close();
System.out.println("Success!");
}
}
*******************************************************************
求英汉词典的JAVA源程序代码这么个东西就算有也发不来啊简单来一段
import java.awt.*;
import java.awt.event.*;
class MyWindow extends Frame implements ActionListener

推荐阅读