資源簡介
java彩票模擬投注系統(tǒng).zip

代碼片段和文件信息
/**
?*?Core.java
?*?2012-12-20
?*/
package?jk.lottery;
import?java.util.Date;
import?java.util.HashSet;
import?java.util.Set;
import?javax.swing.JOptionPane;
import?jk.lottery.data.DatabaseConnector;
import?jk.lottery.ui.ButtonEventAdapter;
import?jk.lottery.ui.ButtonEventListener;
import?jk.lottery.ui.Mainframe;
/**
?*?模擬彩票的核心
?*?
?*?@author?xiaoming
?*/
public?class?Core?{
private?Mainframe?frame;
private?ButtonEventListener?welcomScreen;
private?ButtonEventListener?buyScreen;
private?ButtonEventListener?inputNumberScreen;
private?int[][]?storedNumbers;
private?int?nowInputCount;
private?DatabaseConnector?databaseConnector;
private?ButtonEventListener?inputMonthScreen;
/**
?*?構造函數(shù)
?*?
?*?@param?frame
?*????????????顯示界面的框架
?*?@param?databaseConnector
?*????????????連接數(shù)據(jù)庫的對象
?*/
public?Core(final?Mainframe?frame?final?DatabaseConnector?databaseConnector)?{
this.frame?=?frame;
this.databaseConnector?=?databaseConnector;
this.welcomScreen?=?creatWelcomScreen();
this.buyScreen?=?creatBuyScreen();
this.inputNumberScreen?=?createInputNumberScreen();
this.inputMonthScreen?=?createInputMonthScreen();
}
/**
?*?啟動系統(tǒng)
?*/
public?void?start()?{
this.frame.setVisible(true);
changeToWelcomScreen();
}
/**
?*?將當前輸入次數(shù)加1
?*/
private?void?addNowInputCount()?{
this.nowInputCount++;
}
/**
?*?購買已經(jīng)儲存的號碼
?*/
private?void?buyStoredNumbers()?{
printLotterys();
updateDatabase();
changeToWelcomScreen();
}
/**
?*?改變輸入框的焦點
?*?用來在多個輸入框的時候在多個輸入框之間切換
?*?
?*?@param?focusIndex
?*/
private?void?changeInputFocus(final?int?focusIndex)?{
this.frame.changeInputFocus(focusIndex);
}
/**
?*?切換到購買的畫面
?*/
private?void?changeToBuyScreen()?{
this.frame.showInputScreen(“每注彩票價格2元\n“?+?“每張彩票最多五注\n“?+?“超出的部分將打印在下一張,請輸入您的要購買的數(shù)量:\n“
+?“按面板上的【確定】鍵結束\n“?+?“按面板上的【返回】鍵將返回前一個畫面“?1);
this.frame.setButtonEventListener(this.buyScreen);
}
/**
?*?切換到輸入查詢結束月份的畫面
?*/
private?void?changeToInputLastMonthScreen()?{
this.frame.showInputScreen(“請輸入要查詢的數(shù)據(jù)的結束月份“?1);
this.frame.setButtonEventListener(this.inputMonthScreen);
}
/**
?*?切換到輸入號碼畫面
?*?
?*?@param?buyCount
?*/
private?void?changeToInputNumberScreen(final?int?buyCount)?{
this.frame.showInputScreen(“計科風采99選5,請從0到99中選擇5個數(shù)字\n請輸入您要投注的號碼,這是第“?+?buyCount?+?“注,共“
+?this.storedNumbers.length?+?“注\n“?+?“請用【←】【→】和數(shù)字鍵輸入號碼,按【購買】鍵隨機選擇號碼\n“
+?“完成后請按面板上的【確定】鍵,按【退出】鍵取消本次購買“?5);
this.frame.setButtonEventListener(this.inputNumberScreen);
}
/**
?*?切換到查詢畫面
?*/
private?void?changeToQueryScreen()?{
this.frame.showInputScreen(“請輸入要查詢的數(shù)據(jù)的開始月份“?1);
this.frame.setButtonEventListener(this.inputMonthScreen);
}
/**
?*?切換到顯示統(tǒng)計數(shù)據(jù)畫面
?*?
?*?@param?lastMonth
?*????????????顯示的數(shù)據(jù)的頭一個月
?*?@param?firstMonth
?*????????????顯示的數(shù)據(jù)的最后一個月
?*?
?*/
private?void?changeToShowDataScreen(final?int?firstMonth?final?int?lastMonth)?{
t
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-12-22?22:45??java期末考試\
?????目錄???????????0??2012-12-22?22:43??java期末考試\模擬彩票機\
?????文件?????????295??2012-12-21?18:35??java期末考試\模擬彩票機\.classpath
?????文件?????????391??2012-12-20?12:54??java期末考試\模擬彩票機\.project
?????目錄???????????0??2012-12-22?22:43??java期末考試\模擬彩票機\.settings\
?????文件?????????629??2012-12-20?12:54??java期末考試\模擬彩票機\.settings\org.eclipse.jdt.core.prefs
?????目錄???????????0??2012-12-22?22:43??java期末考試\模擬彩票機\bin\
?????目錄???????????0??2012-12-22?22:43??java期末考試\模擬彩票機\bin\jk\
?????目錄???????????0??2012-12-22?22:43??java期末考試\模擬彩票機\bin\jk\lottery\
?????文件????????1084??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\Core$1.class
?????文件????????1376??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\Core$2.class
?????文件????????1925??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\Core$3.class
?????文件????????3200??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\Core$4.class
?????文件?????????758??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\Core$5.class
?????文件????????7573??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\Core.class
?????目錄???????????0??2012-12-22?22:43??java期末考試\模擬彩票機\bin\jk\lottery\data\
?????文件????????1719??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\data\Databa
?????文件????????1976??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\data\LotteryTableModel.class
?????目錄???????????0??2012-12-22?22:43??java期末考試\模擬彩票機\bin\jk\lottery\main\
?????文件?????????965??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\main\Main.class
?????目錄???????????0??2012-12-22?22:43??java期末考試\模擬彩票機\bin\jk\lottery\ui\
?????文件?????????791??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\ui\ButtonEventAdapter.class
?????文件?????????299??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\ui\ButtonEventListener.class
?????文件?????????848??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\ui\Mainfr
?????文件?????????850??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\ui\Mainfr
?????文件?????????848??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\ui\Mainfr
?????文件?????????847??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\ui\Mainfr
?????文件????????1031??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\ui\Mainfr
?????文件????????8737??2012-12-22?22:42??java期末考試\模擬彩票機\bin\jk\lottery\ui\Mainfr
?????目錄???????????0??2012-12-22?22:43??java期末考試\模擬彩票機\src\
?????目錄???????????0??2012-12-22?22:43??java期末考試\模擬彩票機\src\jk\
............此處省略11個文件信息
評論
共有 條評論