這么個東西就算有也發(fā)不來啊 簡單來一段
創(chuàng)新互聯(lián)是一家專注網(wǎng)站建設(shè)、網(wǎng)絡(luò)營銷策劃、微信小程序定制開發(fā)、電子商務(wù)建設(shè)、網(wǎng)絡(luò)推廣、移動互聯(lián)開發(fā)、研究、服務(wù)為一體的技術(shù)型公司。公司成立十載以來,已經(jīng)為1000+成都地磅秤各業(yè)的企業(yè)公司提供互聯(lián)網(wǎng)服務(wù)?,F(xiàn)在,服務(wù)的1000+客戶與我們一路同行,見證我們的成長;未來,我們一起分享成功的喜悅。
import java.awt.*;
import java.awt.event.*;
class MyWindow extends Frame implements ActionListener
{ TextField text1,text2,text3;
MyWindow()
{ setLayout(new FlowLayout());
text1=new TextField(8);
text2=new TextField(8);
text3=new TextField(15);
add(text1);
add(text2);
add(text3);
text1.addActionListener(this);
text2.addActionListener(this);
setBounds(100,100,150,150);
setVisible(true);
validate();
}
public void actionPerformed(ActionEvent e)
{ if(e.getSource()==text1)
{ String word=text1.getText();
if(word.equals("boy"))
{ text3.setText("男孩");
}
else if (word.equals("girl"))
{ text3.setText("女孩");
}
else if (word.equals("sun"))
{ text3.setText("太陽");
}
else
{ text3.setText("沒有該單詞");
}
}
else if(e.getSource()==text2)
{ String word=text2.getText();
if(word.equals("男孩"))
{ text3.setText("boy");
}
else if (word.equals("女孩"))
{ text3.setText("girl");
}
else if (word.equals("太陽"))
{ text3.setText("sun");
}
else
{ text3.setText("沒有該單詞");
}
}
}
}
public class Example
{ public static void main(String args[])
{
new MyWindow();
new MyWindow();
new MyWindow();
new MyWindow();
}
}
文本框輸入再回車.即可.
地址在下面 金山詞霸
迅雷直接下
如果不行 網(wǎng)址
安裝方法
1.購買一個T-Flash卡的讀卡器,T-Flash卡專用讀卡器推薦
2.關(guān)機,取下TF卡把卡裝在讀卡器上與電腦連接,打開:mobile。
3.打開文件:kjava 將你所喜歡的多個JVAV游戲壓縮文件復(fù)制過來,然后解壓全部文件,關(guān)閉窗口。
4.把T-Flash卡卡裝回手機。打開手機的游戲和應(yīng)用程序→轉(zhuǎn)存儲卡設(shè)置→選擇卡進入安裝新應(yīng)用程序→選擇→安裝→下載→存儲→多個安裝→完成。
補充:我沒有ACCESS,我用的是odbc直接連接mdb文件,你可以用ACCESS同時操作mdb文件.如果要用到ACCESS,請修改bean中的屬性值.
你的東西做的很好
只是數(shù)據(jù)庫連接出了問題
這是我為你的工程寫的一個關(guān)于數(shù)據(jù)庫的bean
提供了一系列的數(shù)據(jù)操作方法
該類已經(jīng)測試成功,只要添加到你的工程里就可以了。希望對你有用。
package lg_cidian;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
/**
* 數(shù)據(jù)庫操作的JavaBean類,用于對數(shù)據(jù)庫的查詢與更新的實現(xiàn);
* 該類默認的連接的數(shù)據(jù)庫為odbc連接本地數(shù)據(jù)文件;
* 該類主要為用戶一系列的數(shù)據(jù)操作提供底層服務(wù).
*
* @version 1.0 2010/06/13
* @author Kiwwor
* @see UserData
*/
public class Access {
//驅(qū)動程序類
private String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
//連接數(shù)據(jù)庫url
private String connectionUrl="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)}; DBQ=en.mdb";
//用戶名
private String user = "";
//用戶密碼
private String password = "";
//數(shù)據(jù)庫連接對象
private Connection connection = null;
//數(shù)據(jù)庫對象
private Statement statement = null;
//數(shù)據(jù)集對象
private ResultSet resultSet = null;
public String getDriver() {
return driver;
}
public void setDriver(String driver) {
this.driver = driver;
}
public String getConnectionUrl() {
return connectionUrl;
}
public void setConnectionUrl(String connectionUrl) {
this.connectionUrl = connectionUrl;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Connection getConnection() {
return connection;
}
public void setConnection(Connection connection) {
this.connection = connection;
}
public Statement getStatement() {
return statement;
}
public void setStatement(Statement statement) {
this.statement = statement;
}
public ResultSet getResultSet() {
return resultSet;
}
public void setResultSet(ResultSet resultSet) {
this.resultSet = resultSet;
}
/**
* 獲取一個連接對象,默認連接對象本地數(shù)據(jù)庫qq。
* @return 連接是否成功
*/
public boolean createConnection() {
boolean b = false;
try {
Class.forName(driver);
connection = DriverManager.getConnection(connectionUrl, user, password);
b = true;
} catch (Exception e) {
e.printStackTrace();
}
return b;
}
/**
* 更新數(shù)據(jù)庫
* @param sql 更新的sql語句
* @return 更新是否成功
*/
public boolean update(String sql) {
boolean b =false;
try {
statement = connection.createStatement();
statement.execute(sql);
b = true;
} catch (Exception e) {
e.printStackTrace();
}
return b;
}
/**
* 執(zhí)行查詢,將查詢的結(jié)果集給resultmentSet。
* @param sql 查詢的sql語句
*/
public void query(String sql) {
try {
statement = connection.createStatement();
resultSet = statement.executeQuery(sql);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 檢測結(jié)果集是否為空
* @return true為存在記錄
*/
public boolean next() {
boolean b = false;
try {
if (resultSet.next()) b = true;
} catch (Exception e) {
e.printStackTrace();
}
return b;
}
/**
* 獲得結(jié)果集中當(dāng)前行columnLabel的記錄
* @param columnLabel 當(dāng)前行要查詢的列名.
* @return 查詢的列值
*/
public String getValue(String columnLabel) {
String value = null;
try {
if (resultSet != null) value = resultSet.getString(columnLabel);
} catch (Exception e) {
e.printStackTrace();
}
return value;
}
/**
* 獲得結(jié)果集中當(dāng)前行columnIndex的記錄
* @param columnIndex 當(dāng)前行查詢的列索引,第一列為1,第二列為2...
* @return 查詢的列值
*/
public String getValue(int columnIndex) {
String value = null;
try {
if (resultSet != null) value = resultSet.getString(columnIndex);
} catch (Exception e) {
e.printStackTrace();
}
return value;
}
/**
* 關(guān)閉連接對象
*/
public void closeConnection() {
try {
if (connection != null) connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* 關(guān)閉數(shù)據(jù)庫對象
*/
public void closeStatement() {
try {
if (statement != null) statement.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* 關(guān)閉結(jié)果集
*/
public void closeResultSet() {
try {
if (resultSet != null) resultSet.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* 關(guān)閉數(shù)據(jù)連接對象,數(shù)據(jù)庫對象和數(shù)據(jù)結(jié)果集對象。
*/
public void closeAll() {
closeResultSet();
closeStatement();
closeConnection();
}
/**
* 測試該類函數(shù)。
* @param args
*/
public static void main(String[] args) {
Access db = new Access();
if (db.createConnection()) {
System.out.println("測試數(shù)據(jù)庫連接成功.");
}
db.closeAll();
}
}
新聞名稱:java詞典代碼下載 java英漢詞典完整程序
標(biāo)題路徑:http://muchs.cn/article4/ddcjdoe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站營銷、網(wǎng)站內(nèi)鏈、域名注冊、虛擬主機、企業(yè)建站、建站公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)