您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 资本运营 > java小程序之年终抽奖系统
/**CardJFrame.java**Createdon__DATE__,__TIME__*/packagecom.insigma.cardJfram;importjava.io.BufferedReader;importjava.io.FileInputStream;importjava.io.IOException;importjava.io.InputStreamReader;importjava.net.URLDecoder;importcom.insigma.thread.CardThread;importcom.insigma.thread.ImageThread;importcom.insigma.util.CommUtil;/****@author__USER__*/publicclassCardJFrameextendsjavax.swing.JFrame{/**CreatesnewformCardJFrame*/publicCardJFrame(){initComponents();try{showUser();}catch(IOExceptione){//TODOAuto-generatedcatchblocke.printStackTrace();}this.setLocationRelativeTo(null);//居中显示jLabel3.setText(gogogogo...!);}/***将待抽奖人员显示在待抽奖框中**@throwsIOException**/publicvoidshowUser()throwsIOException{StringfileName=URLDecoder.decode(Class.class.getResource(/com/insigma/names/names.txt).getPath());FileInputStreamfileInputStream=newFileInputStream(fileName);InputStreamReaderinputStreamReader=newInputStreamReader(fileInputStream,GBK);BufferedReaderbufferedReader=newBufferedReader(inputStreamReader);Stringname=;StringbufName=;inti=0;while((name=bufferedReader.readLine())!=null){if(bufName.equals())bufName=name;elsebufName=bufName+\n+name;CommUtil.map.put(i,name);i++;}this.jTextArea1.setText(bufName);}/***Thismethodiscalledfromwithintheconstructortoinitializetheform.*WARNING:DoNOTmodifythiscode.Thecontentofthismethodisalways*regeneratedbytheFormEditor.*///GEN-BEGIN:initComponents//editor-folddefaultstate=collapseddesc=GeneratedCodeprivatevoidinitComponents(){jLabel1=newjavax.swing.JLabel();jScrollPane1=newjavax.swing.JScrollPane();jTextArea1=newjavax.swing.JTextArea();jLabel2=newjavax.swing.JLabel();jLabel3=newjavax.swing.JLabel();jLabel4=newjavax.swing.JLabel();jScrollPane2=newjavax.swing.JScrollPane();jTextArea2=newjavax.swing.JTextArea();jLabel5=newjavax.swing.JLabel();jScrollPane3=newjavax.swing.JScrollPane();jTextArea3=newjavax.swing.JTextArea();jLabel6=newjavax.swing.JLabel();jScrollPane4=newjavax.swing.JScrollPane();jTextArea4=newjavax.swing.JTextArea();jButton1=newjavax.swing.JButton();jButton2=newjavax.swing.JButton();jButton3=newjavax.swing.JButton();setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);jLabel1.setText(\u5458\u5de5\u540d\u5355\uff1a);jTextArea1.setColumns(20);jTextArea1.setRows(5);jTextArea1.setBorder(javax.swing.BorderFactory.createLineBorder(newjava.awt.Color(0,0,0)));jScrollPane1.setViewportView(jTextArea1);jLabel2.setText(\u5458\u5de5\u76f8\u7247\uff1a);jLabel3.setBorder(javax.swing.BorderFactory.createLineBorder(newjava.awt.Color(0,0,0)));jLabel4.setText(\u4e00\u7b49\u5956\u4eba\u5458\uff1a);jTextArea2.setColumns(20);jTextArea2.setRows(5);jScrollPane2.setViewportView(jTextArea2);jLabel5.setText(\u4e8c\u7b49\u5956\u4eba\u5458\uff1a);jTextArea3.setColumns(20);jTextArea3.setRows(5);jScrollPane3.setViewportView(jTextArea3);jLabel6.setText(\u4e09\u7b49\u5956\u4eba\u5458\uff1a);jTextArea4.setColumns(20);jTextArea4.setRows(5);jScrollPane4.setViewportView(jTextArea4);jButton1.setText(\u5f00\u59cb);jButton1.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){jButton1ActionPerformed(evt);}});jButton2.setText(\u6682\u505c);jButton2.setEnabled(false);jButton2.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){jButton2ActionPerformed(evt);}});jButton3.setText(\u91cd\u7f6e);jButton3.setEnabled(false);jButton3.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){jButton3ActionPerformed(evt);}});javax.swing.GroupLayoutlayout=newjavax.swing.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(30,30,30).addComponent(jLabel4).addGap(103,103,103).addComponent(jLabel5).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,61,Short.MAX_VALUE).addComponent(jLabel6).addGap(77,77,77)).addGroup(layout.createSequentialGroup().addGap(64,64,64).addComponent(jButton1).addGap(94,94,94).addComponent(jButton2).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,94,Short.MAX_VALUE).addComponent(jButton3).addGap(64,64,64)).addGroup(javax.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(43,43,43).addComponent(jLabel1)).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jScrollPane1,0,0,Short.MAX_VALUE).addComponent(jScrollPane2,javax.swing.GroupLayout.PREFERRED_SIZE,136,javax.swing.GroupLayout.PREFERRED_SIZE)))).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,14,Short.MAX_VALUE).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(35,3
本文标题:java小程序之年终抽奖系统
链接地址:https://www.777doc.com/doc-5858114 .html