91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 7KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-15
  • 語言: 其他
  • 標簽: java??

資源簡介

用來記錄生詞,可隨機抽取單詞進行鞏固知識的小程序

資源截圖

代碼片段和文件信息

package?com.dingge.words.input;

import?java.io.BufferedReader;
import?java.io.BufferedWriter;
import?java.io.FileNotFoundException;
import?java.io.FileReader;
import?java.io.FileWriter;
import?java.io.IOException;
import?java.util.ArrayList;
import?java.util.HashMap;
import?java.util.List;

import?javax.swing.Jframe;
import?javax.swing.JOptionPane;


public?class?ClientContext?{
private?Mainframe?mainframe;
public?void?setMainframe(Mainframe?mainframe){
this.mainframe?=?mainframe;
}

private?Reserveframe?reserveframe;
public?void?setReserveframe(Reserveframe?reserveframe){
this.reserveframe?=?reserveframe;
}

private?Startframe?startframe;
public?void?setStartframe(Startframe?startframe){
this.startframe?=?startframe;
}

public?void?show(){
startframe.setVisible(true);
}

public?void?start(){
mainframe.setVisible(true);
startframe.setVisible(false);
}

public?void?reserve(){
reserveframe.updateview();
reserveframe.setVisible(true);
}

public?void?cancel(){
reserveframe.setVisible(false);
}

public?void?exit(Jframe?source){
int?val?=JOptionPane.showConfirmDialog(source?“真的不背單詞了?“);
if(val==JOptionPane.YES_OPTION){
System.exit(0);
}
}

private?HashMap?words?=
new?HashMap();
private?int?ind;
public?void?loadWords(String?filename)?throws?IOException?{
try?{
BufferedReader?in?=?new?BufferedReader(new?FileReader(filename));
String?line;
while((line?=?in.readLine())?!=?null){
line?=?line.trim();
if(line.equals(““)){
continue;
}
????Word?one?=?parseWord(line);
????words.put(one.getIndex()?one);
}
ind?=?words.size();
????????????in.close();
}catch?(FileNotFoundException?e)?{
//?TODO?Auto-generated?catch?block
e.printStackTrace();
}
}
//private?Word?wordall?=?new?Word();
public?Word?parseWord(String?line){
String[]?data?=?line.split(“:“);
Word?wordall?=?new?Word();
wordall.setIndex(Integer.parseInt(data[0]));
wordall.setWord(data[1]);
wordall.setChinese(data[2]);
wordall.setProperty(data[3]);
return?wordall;
}
private?List?list?=?new?ArrayList(words.values());;
public?Word?createWord()?throws?IOException{
????loadWords(“word.txt“);
list?=?new?ArrayList(words.values());
int?pos?=?(int)Math.floor(Math.random()*list.size());?
Word?oneWord?=?list.get(pos);
return?oneWord;
}
private?Word?randomWord;
private?boolean?showWordis?=?false;
public?void?showWord(){
try?{
randomWord?=?createWord();
mainframe.updateView(randomWord);
showWordis?=?true;
}?catch?(IOException?e)?{
//?TODO?Auto-generated?catch?block
e.printStackTrace();
}
}

public?void?showWordAll(){
if(showWordis){
????mainframe.updateViewAll(randomWord);
showWordis?=?false;
}else{
JOptionPane.showMessageDialog(null?“親,請先隨機抽取新單詞“);
}
}
private?String?w

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????2340??2013-10-11?23:45??input\cd.png

?????文件???????4128??2013-10-18?16:06??input\ClientContext.java

?????文件????????679??2013-10-14?11:44??input\Main.java

?????文件???????2682??2013-10-18?12:29??input\Mainframe.java

?????文件????????177??2013-10-10?16:31??input\Reserve.java

?????文件???????3301??2013-10-18?16:06??input\Reserveframe.java

?????文件???????1610??2013-10-15?11:38??input\Startframe.java

?????文件????????834??2013-10-16?12:42??input\Word.java

?????目錄??????????0??2013-10-21?12:46??input

-----------?---------??----------?-----??----

????????????????15751????????????????????9


評論

共有 條評論