admin管理员组文章数量:1531791
2024年6月22日发(作者:)
/*主界面
*
*
* Created on __DATE__, __TIME__
*/
package ;
import edReader;
import putStream;
import ption;
import treamReader;
import oder;
import g;
import ;
import ger;
import nceLookAndFeel;
import rdGradientPainter;
import nceTerracottaTheme;
import read;
import il;
import hread;
/**
*
* @author __USER__
*/
public class MainFrame extends g
{
/** Creates new form MainFrame */
public MainFrame( parent, boolean modal)
{
super(parent, modal);
initComponents();
ationRelativeTo(null);// 居中显示
try
{
kAndFeel(new SubstanceLookAndFeel());
aultLookAndFeelDecorated(true);
aultLookAndFeelDecorated(true);
//
//
}
SubstanceLookAndFeel
.setCurrentTheme(new SubstanceTerracottaTheme());
//n(new EmeraldDuskSkin());
//rentButtonShaper(new
//ClassicButtonShaper());
//rentWatermark(new
//SubstanceBubblesWatermark());
//rentBorderPainter(new
// StandardBorderPainter());
// rentGradientPainter(new
//StandardGradientPainter());//水晶蓝
rentTitlePainter(new
FlatTitlePainter());
} catch (Exception e)
{
n("Something went wrong!");
}
try
{
showPerson();
} catch (IOException e)
{
// TODO Auto-generated catch block
tackTrace();
}
public void showPerson() throws IOException
{
String filename = (ource(
"/com/insigma/config/").getPath());
FileInputStream fileInputStream = new FileInputStream(filename);
InputStreamReader inputStreamReader = new InputStreamReader(
fileInputStream, "gbk");
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String name = "";
String bufname = "";
int key = 1;
while ((name = ne()) != null)
{
}
if ((""))
bufname = name;
else
bufname = bufname + "n" + name;
(key, name);
key++;
}
t(bufname);
t("准备......!");
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
//GEN-BEGIN:initComponents
//
private void initComponents()
{
jLabel1 = new ();
jLabel2 = new ();
jLabel3 = new ();
jScrollPane1 = new lPane();
jTextArea1 = new rea();
jScrollPane2 = new lPane();
jTextArea2 = new rea();
jScrollPane3 = new lPane();
jTextArea3 = new rea();
jLabel4 = new ();
jLabel5 = new ();
jScrollPane4 = new lPane();
jTextArea4 = new rea();
jButton1 = new n();
jButton2 = new n();
jButton3 = new n();
jLabel6 = new ();
setDefaultCloseOperation(E_ON_CLOSE);
setTitle("u516cu53f8u5e74u7ec8u62bdu5956u7cfbu7edf");
t("u4e00u7b49u5956u83b7u5f97u8005uff1a");
t("u4e8cu7b49u5956u83b7u5f97u8005uff1a");
t("u4e09u7b49u5956u83b7u5f97u8005uff1a");
umns(20);
s(5);
wportView(jTextArea1);
umns(20);
s(5);
wportView(jTextArea2);
umns(20);
s(5);
wportView(jTextArea3);
t(new ("宋体", 1, 18));
eground(new (255, 0, 0));
der(Factory
.createLineBorder(new (0, 0, 0)));
t("u62bdu5956u8005u540du5355uff1a");
umns(20);
s(5);
wportView(jTextArea4);
t("u5f00u59cb");
ionListener(new Listener()
{
public void actionPerformed(Event evt)
{
jButton1ActionPerformed(evt);
}
});
t("u6682u505c");
bled(false);
ionListener(new Listener()
{
public void actionPerformed(Event evt)
{
jButton2ActionPerformed(evt);
}
});
t("u91cdu7f6e");
bled(false);
ionListener(new Listener()
{
public void actionPerformed(Event evt)
{
jButton3ActionPerformed(evt);
}
});
t(new ("微软雅黑", 1, 36));
eground(new (153, 0, 153));
t("u516cu53f8u5e74u7ec8u62bdu5956");
ayout layout = new ayout(
getContentPane());
getContentPane().setLayout(layout);
izontalGroup(layout
.createParallelGroup(G)
.addGroup(
SequentialGroup()
.addGroup(
ParallelGroup(
G)
.addGroup(
SequentialGroup()
.addGap(98, 98,
98)
.addComponent(
jButton1)
.addGap(47, 47,
47)
.addComponent(
jButton3)
.addGap(44, 44,
44)
.addComponent(
jButton2)
.addGap(104,
104,
104))
.addGroup(
SequentialGroup()
.addContainerGap()
.addGroup(
ParallelGroup(
G)
.addGroup(
SequentialGroup()
.addGroup(
ParallelGroup(
G)
.addComponent(
jScrollPane1,
RED_SIZE,
142,
RED_SIZE)
.addComponent(
jLabel1))
.addPreferredGap(
D,
14,
_VALUE)
.addGroup(
ParallelGroup(
G)
.addComponent(
jLabel2)
.addComponent(
jScrollPane2,
RED_SIZE,
137,
RED_SIZE))
.addGap(33,
33,
33)
.addGroup(
ParallelGroup(
G)
.addComponent(
jScrollPane3,
RED_SIZE,
126,
RED_SIZE)
.addComponent(
jLabel3)))
.addGroup(
SequentialGroup()
.addGap(108,
108,
108)
.addComponent(
jLabel6))
.addComponent(
jLabel5)
.addGroup(
SequentialGroup()
.addComponent(
jScrollPane4,
RED_SIZE,
134,
RED_SIZE)
.addPreferredGap(
D,
80,
_VALUE)
.addComponent(
jLabel4,
RED_SIZE,
116,
RED_SIZE)
.addGap(122,
122,
122)))
.addPreferredGap(
D)))
.addGap(13, 13, 13)));
ticalGroup(layout
.createParallelGroup(G)
.addGroup(
SequentialGroup()
.addComponent(jLabel6)
.addGap(26, 26, 26)
.addGroup(
ParallelGroup(
NG)
.addGroup(
SequentialGroup()
.addComponent(
jLabel1)
.addPreferredGap(
D)
jScrollPane1,
RED_SIZE,
T_SIZE,
RED_SIZE))
.addGroup(
SequentialGroup()
ParallelGroup(
NE)
.addComponent(
jLabel3)
.addComponent(
jLabel2))
D)
ParallelGroup(
G)
.addComponent(
jScrollPane3,
RED_SIZE,
T_SIZE,
RED_SIZE)
.addComponent(
.addGroup(
.addPreferredGap(
.addGroup(
.addComponent(
jScrollPane2,
RED_SIZE,
T_SIZE,
RED_SIZE))))
.addGap(28, 28, 28)
.addComponent(jLabel5)
.addPreferredGap(
D)
.addGroup(
ParallelGroup(
NG)
.addComponent(
jLabel4,
T_SIZE,
148, _VALUE)
.addComponent(
jScrollPane4,
T_SIZE,
148, _VALUE))
.addPreferredGap(
D)
.addGroup(
ParallelGroup(
NG)
.addComponent(jButton1)
.addGroup(
ParallelGroup(
NE)
.addComponent(
jButton3)
jButton2)))
.addComponent(
.addContainerGap()));
pack();
}//
//GEN-END:initComponents
/**
* 重置事件
* @param evt
*/
private void jButton3ActionPerformed(Event evt)
{
bled(true);
bled(false);
= false;
//重置计数器
um = 0;
sum = 0;
um = 0;
//清空抽奖框
t("");
t("");
t("");
//重置人员
try
{
showPerson();
} catch (IOException e)
{
// TODO Auto-generated catch block
tackTrace();
}
}
/**
* 暂停事件
* @param evt
*/
private void jButton2ActionPerformed(Event evt)
{
}
= false;
bled(false);
bled(true);
/**
* 开始事件
* @param evt
*/
private void jButton1ActionPerformed(Event evt)
{
= true;
t(null);
CardThread cardthread = new CardThread(this);
();
ImageThread imageThread = new ImageThread(this);
();
new Thread(cardthread).start();
new Thread(cardthread).start();
new Thread(cardthread).start();
new Thread(cardthread).start();
bled(false);
bled(true);
}
/**
* @param args the command line arguments
*/
public static void main(String args[])
{
Later(new Runnable()
{
public void run()
{
MainFrame dialog = new MainFrame(new (), true);
dowListener(new Adapter()
{
public void windowClosing(Event e)
{
(0);
}
});
ible(true);
}
});
}
//GEN-BEGIN:variables
// Variables declaration - do not modify
public n jButton1;
public n jButton2;
public n jButton3;
public jLabel1;
private jLabel2;
private jLabel3;
public jLabel4;
private jLabel5;
private jLabel6;
private lPane jScrollPane1;
private lPane jScrollPane2;
private lPane jScrollPane3;
private lPane jScrollPane4;
public rea jTextArea1;
public rea jTextArea2;
public rea jTextArea3;
public rea jTextArea4;
// End of variables declaration//GEN-END:variables
}
抽奖功能:
package il;
import ame;
public class CardThread extends Thread
{
private MainFrame mainframe;
public CardThread(MainFrame mainframe)
{
ame = mainframe;
}
public void run()
{
}
synchronized (mainframe)
{
firstCard();
secondCard();
thirdCard();
}
if (())
{
bled(false);
t("抽奖结束!");
bled(false);
bled(true);
}
/**
* 抽一等奖
*/
public void firstCard()
{
while ( && um < ount)
{
int key = (int) (() * 60 + 1);
if (son(key))
{
String name = (key);
if (t() != null
&& !t().equals(""))
{
t(t()
+ "n" + name);
} else
{
t(name);
}
Person(key);
String bufname = tring();
t(bufname);
um++;
try
{
sleep(1000);
}
}
}
} catch (InterruptedException e)
{
// TODO Auto-generated catch block
tackTrace();
}
/**
* 抽三等奖
*/
public void thirdCard()
{
while ( && um < ount)
{
int key = (int) (() * 60 + 1);
if (son(key))
{
String name = (key);
if (t() != null
&& !t().equals(""))
{
t(t()
+ "n" + name);
} else
{
t(name);
}
Person(key);
String bufname = tring();
t(bufname);
um++;
try
{
sleep(1000);
} catch (InterruptedException e)
{
// TODO Auto-generated catch block
tackTrace();
}
}
}
}
/**
* 抽二等奖
*/
public void secondCard()
{
while ( && sum < count)
{
int key = (int) (() * 60 + 1);
if (son(key))
{
String name = (key);
if (t() != null
&& !t().equals(""))
{
t(t()
+ "n" + name);
} else
{
t(name);
}
Person(key);
String bufname = tring();
t(bufname);
sum++;
try
{
sleep(1000);
} catch (InterruptedException e)
{
// TODO Auto-generated catch block
tackTrace();
}
}
}
}
}
工具类:
package il;
import p;
import ;
import ;
public class CommUtil
{
public static boolean boo = false;
public static Map
/**
* 奖项获奖人数
*/
public static int firstcount = 1;
public static int secondcount = 3;
public static int thirdcount = 5;
/**
* 计数器
*/
public static int firstsum = 0;
public static int secondsum = 0;
public static int thirdsum = 0;
/**
* 查找人员
*/
public static boolean getPerson(int key)
{
boolean boo = false;
if((key)!=null && !(key).equals(""))
{
boo = true;
}
return boo;
}
public static boolean isEnd()
{
boolean boo = false;
if(firstcount == firstsum && secondcount==secondsum && thirdcount==thirdsum)
{
boo = true;
}
return boo;
}
/**
* 删除人员
*/
public static boolean deletePerson(int key)
{
boolean boo = false;
(key);
return boo;
}
/**
* map转换为字符串
*/
public static String mapToString()
{
String bufname = "";
Set<
for (
{
String name = ue();
if((""))
bufname = name;
else
bufname = bufname+"n"+name;
}
return bufname;
}
}
显示头像:
package il;
import ame;
public class ImageThread extends Thread
{
private MainFrame mainframe;
public ImageThread(MainFrame mainframe)
{
ame = mainframe;
}
public void run()
}
{
}
showImage();
if (())
{
n(null);
}
public void showImage()
{
}
while ( && !())
{
int key = (int) (() * 60 + 1);
if (son(key))
{
String name = (key);
if (name != null)
{
name = ing(0, f(","));
n(new con(
getClass().getResource(
"/com/insigma/imag/" + name + ".jpg")));
try
{
sleep(1000);
} catch (InterruptedException e)
{
// TODO Auto-generated catch block
tackTrace();
}
}
}
}
版权声明:本文标题:JAVA抽奖系统源代码 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1719002892a747588.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论