JAVA抽奖系统源代码.docx

上传人:b****2 文档编号:1801245 上传时间:2023-05-01 格式:DOCX 页数:21 大小:18.31KB
下载 相关 举报
JAVA抽奖系统源代码.docx_第1页
第1页 / 共21页
JAVA抽奖系统源代码.docx_第2页
第2页 / 共21页
JAVA抽奖系统源代码.docx_第3页
第3页 / 共21页
JAVA抽奖系统源代码.docx_第4页
第4页 / 共21页
JAVA抽奖系统源代码.docx_第5页
第5页 / 共21页
JAVA抽奖系统源代码.docx_第6页
第6页 / 共21页
JAVA抽奖系统源代码.docx_第7页
第7页 / 共21页
JAVA抽奖系统源代码.docx_第8页
第8页 / 共21页
JAVA抽奖系统源代码.docx_第9页
第9页 / 共21页
JAVA抽奖系统源代码.docx_第10页
第10页 / 共21页
JAVA抽奖系统源代码.docx_第11页
第11页 / 共21页
JAVA抽奖系统源代码.docx_第12页
第12页 / 共21页
JAVA抽奖系统源代码.docx_第13页
第13页 / 共21页
JAVA抽奖系统源代码.docx_第14页
第14页 / 共21页
JAVA抽奖系统源代码.docx_第15页
第15页 / 共21页
JAVA抽奖系统源代码.docx_第16页
第16页 / 共21页
JAVA抽奖系统源代码.docx_第17页
第17页 / 共21页
JAVA抽奖系统源代码.docx_第18页
第18页 / 共21页
JAVA抽奖系统源代码.docx_第19页
第19页 / 共21页
JAVA抽奖系统源代码.docx_第20页
第20页 / 共21页
亲,该文档总共21页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

JAVA抽奖系统源代码.docx

《JAVA抽奖系统源代码.docx》由会员分享,可在线阅读,更多相关《JAVA抽奖系统源代码.docx(21页珍藏版)》请在冰点文库上搜索。

JAVA抽奖系统源代码.docx

JAVA抽奖系统源代码

/*主界面

*MainFrame.java

*

*Createdon__DATE__,__TIME__

*/

/**

*

*@author__USER__

*/

{

/**CreatesnewformMainFrame*/

{

super(parent,modal);

initComponents();

this.setLocationRelativeTo(null);//居中显示

try

{

UIManager.setLookAndFeel(newSubstanceLookAndFeel());

JFrame.setDefaultLookAndFeelDecorated(true);

JDialog.setDefaultLookAndFeelDecorated(true);

SubstanceLookAndFeel

.setCurrentTheme(newSubstanceTerracottaTheme());

//SubstanceLookAndFeel.setSkin(newEmeraldDuskSkin());

//SubstanceLookAndFeel.setCurrentButtonShaper(new

//ClassicButtonShaper());

//SubstanceLookAndFeel.setCurrentWatermark(new

//SubstanceBubblesWatermark());

//SubstanceLookAndFeel.setCurrentBorderPainter(new

//StandardBorderPainter());

//SubstanceLookAndFeel.setCurrentGradientPainter(new

//StandardGradientPainter());//水晶蓝

//SubstanceLookAndFeel.setCurrentTitlePainter(new

//FlatTitlePainter());

}catch(Exceptione)

{

}

try

{

showPerson();

}catch(IOExceptione)

{

//TODOAuto-generatedcatchblock

e.printStackTrace();

}

}

publicvoidshowPerson()throwsIOException

{

"/com/insigma/config/name.txt").getPath());

FileInputStreamfileInputStream=newFileInputStream(filename);

InputStreamReaderinputStreamReader=newInputStreamReader(

fileInputStream,"gbk");

BufferedReaderbufferedReader=newBufferedReader(inputStreamReader);

Stringname="";

Stringbufname="";

intkey=1;

while((name=bufferedReader.readLine())!

=null)

{

if(bufname.equals(""))

bufname=name;

else

bufname=bufname+"\n"+name;

key++;

}

}

/**Thismethodiscalledfromwithintheconstructorto

*initializetheform.

*WARNING:

DoNOTmodifythiscode.Thecontentofthismethodis

*alwaysregeneratedbytheFormEditor.

*/

//GEN-BEGIN:

initComponents

//

privatevoidinitComponents()

{

setTitle("\u516c\u53f8\u5e74\u7ec8\u62bd\u5956\u7cfb\u7edf");

jLabel1.setText("\u4e00\u7b49\u5956\u83b7\u5f97\u8005\uff1a");

jLabel2.setText("\u4e8c\u7b49\u5956\u83b7\u5f97\u8005\uff1a");

jLabel3.setText("\u4e09\u7b49\u5956\u83b7\u5f97\u8005\uff1a");

jTextArea1.setColumns(20);

jTextArea1.setRows(5);

jScrollPane1.setViewportView(jTextArea1);

jTextArea2.setColumns(20);

jTextArea2.setRows(5);

jScrollPane2.setViewportView(jTextArea2);

jTextArea3.setColumns(20);

jTextArea3.setRows(5);

jScrollPane3.setViewportView(jTextArea3);

jLabel5.setText("\u62bd\u5956\u8005\u540d\u5355\uff1a");

jTextArea4.setColumns(20);

jTextArea4.setRows(5);

jScrollPane4.setViewportView(jTextArea4);

jButton1.setText("\u5f00\u59cb");

{

{

jButton1ActionPerformed(evt);

}

});

jButton2.setText("\u6682\u505c");

jButton2.setEnabled(false);

{

{

jButton2ActionPerformed(evt);

}

});

jButton3.setText("\u91cd\u7f6e");

jButton3.setEnabled(false);

{

{

jButton3ActionPerformed(evt);

}

});

jLabel6.setText("\u516c\u53f8\u5e74\u7ec8\u62bd\u5956");

getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(layout

.addGroup(

layout.createSequentialGroup()

.addGroup(

layout.createParallelGroup(

.addGroup(

layout.createSequentialGroup()

.addGap(98,98,

98)

.addComponent(

jButton1)

.addGap(47,47,

47)

.addComponent(

jButton3)

.addGap(44,44,

44)

.addComponent(

jButton2)

.addGap(104,

104,

104))

.addGroup(

layout.createSequentialGroup()

.addContainerGap()

.addGroup(

layout.createParallelGroup(

.addGroup(

layout.createSequentialGroup()

.addGroup(

layout.createParallelGroup(

.addComponent(

jScrollPane1,

142,

.addComponent(

jLabel1))

.addPreferredGap(

14,

Short.MAX_VALUE)

.addGroup(

layout.createParallelGroup(

.addComponent(

jLabel2)

.addComponent(

jScrollPane2,

137,

.addGap(33,

33,

33)

.addGroup(

layout.createParallelGroup(

.addComponent(

jScrollPane3,

126,

.addComponent(

jLabel3)))

.addGroup(

layout.createSequentialGroup()

.addGap(108,

108,

108)

.addComponent(

jLabel6))

.addComponent(

jLabel5)

.addGroup(

layout.createSequentialGroup()

.addComponent(

jScrollPane4,

134,

.addPreferredGap(

80,

Short.MAX_VALUE)

.addComponent(

jLabel4,

116,

.addGap(122,

122,

122)))

.addPreferredGap(

.addGap(13,13,13)));

layout.setVerticalGroup(layout

.addGroup(

layout.createSequentialGroup()

.addComponent(jLabel6)

.addGap(26,26,26)

.addGroup(

layout.createParallelGroup(

.addGroup(

layout.createSequentialGroup()

.addComponent(

jLabel1)

.addPreferredGap(

.addComponent(

jScrollPane1,

.addGroup(

layout.createSequentialGroup()

.addGroup(

layout.createParallelGroup(

.addComponent(

jLabel3)

.addComponent(

jLabel2))

.addPreferredGap(

.addGroup(

layout.createParallelGroup(

.addComponent(

jScrollPane3,

.addComponent(

jScrollPane2,

.addGap(28,28,28)

.addComponent(jLabel5)

.addPreferredGap(

.addGroup(

layout.createParallelGroup(

.addComponent(

jLabel4,

148,Short.MAX_VALUE)

.addComponent(

jScrollPane4,

148,Short.MAX_VALUE))

.addPreferredGap(

.addGroup(

layout.createParallelGroup(

.addComponent(jButton1)

.addGroup(

layout.createParallelGroup(

.addComponent(

jButton3)

.addComponent(

jButton2)))

.addContainerGap()));

pack();

}//

//GEN-END:

initComponents

/**

*重置事件

*@paramevt

*/

{

CommUtil.boo=false;

//重置计数器

CommUtil.firstsum=0;

CommUtil.secondsum=0;

CommUtil.thirdsum=0;

//清空抽奖框

//重置人员

try

{

showPerson();

}catch(IOExceptione)

{

//TODOAuto-generatedcatchblock

e.printStackTrace();

}

}

/**

*暂停事件

*@paramevt

*/

{

CommUtil.boo=false;

}

/**

*开始事件

*@paramevt

*/

{

CommUtil.boo=true;

CardThreadcardthread=newCardThread(this);

cardthread.start();

ImageThreadimageThread=newImageThread(this);

imageThread.start();

newThread(cardthread).start();

newThread(cardthread).start();

newThread(cardthread).start();

newThread(cardthread).start();

}

/**

*@paramargsthecommandlinearguments

*/

publicstaticvoidmain(Stringargs[])

{

{

publicvoidrun()

{

{

{

System.exit(0);

}

});

dialog.setVisible(true);

}

});

}

//GEN-BEGIN:

variables

//Variablesdeclaration-donotmodify

//Endofvariablesdeclaration//GEN-END:

variables

}

抽奖功能:

publicclassCardThreadextendsThread

{

privateMainFramemainframe;

publicCardThread(MainFramemainframe)

{

this.mainframe=mainframe;

}

publicvoidrun()

{

synchronized(mainframe)

{

firstCard();

secondCard();

thirdCard();

}

if(CommUtil.isEnd())

{

}

}

/**

*抽一等奖

*/

publicvoidfirstCard()

{

while(CommUtil.boo&&CommUtil.firstsum

{

intkey=(int)(Math.random()*60+1);

if(CommUtil.getPerson(key))

{

{

+"\n"+name);

}else

{

}

CommUtil.deletePerson(key);

Stringbufname=CommUtil.mapToString();

CommUtil.firstsum++;

try

{

sleep(1000);

}catch(InterruptedExceptione)

{

//TODOAuto-generatedcatchblock

e.printStackTrace();

}

}

}

}

/**

*抽三等奖

*/

publicvoidthirdCard()

{

while(CommUtil.boo&&CommUtil.thirdsum

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 总结汇报 > 学习总结

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2