...

View Full Version : which program to use to create online random draw



chris88
07-16-2009, 06:50 AM
which program should i use to create an online random draw which draw player name randomly
this is for an online tournament management system
i hav a java file of the draw
should i use other easier program to put it online?
or any other suggestion?thx

this is d draw in th pic

BrickInTheWall
07-16-2009, 05:47 PM
I'm not really sure what you mean but I would either go for a Java applet or a flash application.

chris88
07-17-2009, 08:11 AM
I'm not really sure what you mean but I would either go for a Java applet or a flash application.

ya i was thinking of converting it to java applet but i m having some probs
can u help me with my code?

this is the original code

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;


class draw implements ActionListener{
Frame f;
JButton b1,b2,b3;
JLabel l1,l2,l3,l4,l5,l6,l7,l8;
JTextField t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
draw(){
f=new Frame("BADMINTON DRAW");
l1=new JLabel(" vs");
l2=new JLabel(" vs");
l3=new JLabel(" vs");
l4=new JLabel(" vs");
l5=new JLabel(" vs");
l6=new JLabel(" vs");
l7=new JLabel(" vs");
l8=new JLabel(" vs");



t1=new JTextField(15);
t2=new JTextField(15);
t3=new JTextField(15);
t4=new JTextField(15);
t5=new JTextField(15);
t6=new JTextField(15);
t7=new JTextField(15);
t8=new JTextField(15);
t9=new JTextField(15);
t10=new JTextField(15);
t11=new JTextField(15);
t12=new JTextField(15);
t13=new JTextField(15);
t14=new JTextField(15);
t15=new JTextField(15);
t16=new JTextField(15);
t1.setEnabled(false);
t2.setEnabled(false);
t3.setEnabled(false);
t4.setEnabled(false);
t5.setEnabled(false);
t6.setEnabled(false);
t7.setEnabled(false);
t8.setEnabled(false);
t9.setEnabled(false);
t10.setEnabled(false);
t11.setEnabled(false);
t12.setEnabled(false);
t13.setEnabled(false);
t14.setEnabled(false);
t15.setEnabled(false);
t16.setEnabled(false);


b1=new JButton("DRAW");
b2=new JButton("CLEAR");
b3=new JButton("EXIT");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
f.setLayout(new GridLayout(9,3));
f.setVisible(true);
f.setSize(300,300);
f.add(t1);
f.add(l1);
f.add(t2);
f.add(t3);
f.add(l2);
f.add(t4);
f.add(t5);
f.add(l3);
f.add(t6);
f.add(t7);
f.add(l4);
f.add(t8);
f.add(t9);
f.add(l5);
f.add(t10);
f.add(t11);
f.add(l6);
f.add(t12);
f.add(t13);
f.add(l7);
f.add(t14);
f.add(t15);
f.add(l8);
f.add(t16);

f.add(b1);
f.add(b2);
f.add(b3);
f.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e1){System.exit(0);}});
}
public void actionPerformed (ActionEvent e){
String name[]={"(1001)ZHANG NING","(1002)ZHU LIN","(1003)WONG MEW CHOO","(1004)JULIA WONG",
"(1005)PI HONG YAN","(1006)WANG CHEN","(1007)SAINAL NEHWAL","(1008)LI LI","(1009)LYDIA CHEAH",
"(1010)KAORI MORI","(1011)ERIKO HIROSE","(1012)SARA PERSSON","(1013)TINE RASMUSSEN","BYE1","BYE2","BYE3"};


for (int i=0; i<name.length; i++) {
int randomPosition = (int)(Math.random()*(name.length));
String temp = name[i];
name[i] = name[randomPosition];
name[randomPosition] = temp;
}

if (e.getSource()==b1){
t1.setText(name[0]);
t2.setText(name[1]);
t3.setText(name[2]);
t4.setText(name[3]);
t5.setText(name[4]);
t6.setText(name[5]);
t7.setText(name[6]);
t8.setText(name[7]);
t9.setText(name[8]);
t10.setText(name[9]);
t11.setText(name[10]);
t12.setText(name[11]);
t13.setText(name[12]);
t14.setText(name[13]);
t15.setText(name[14]);
t16.setText(name[15]);

}
else if(e.getSource()==b2){
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
t6.setText("");
t7.setText("");
t8.setText("");
t9.setText("");
t10.setText("");
t11.setText("");
t12.setText("");
t13.setText("");
t14.setText("");
t15.setText("");
t16.setText("");

}
else
System.exit(0);
}
public static void main (String args[]){
draw d=new draw();
}
}









this is d 1 i modify for applet

import javax.swing.JApplet;
import java.awt.*;
import java.awt.event.*;


class drawapplet extends Applet implements ActionListener{
Frame f;
JButton b1,b2,b3;
JLabel l1,l2,l3,l4,l5,l6,l7,l8;
JTextField t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
drawappplet(){
f=new Frame("BADMINTON DRAW");
l1=new JLabel(" vs");
l2=new JLabel(" vs");
l3=new JLabel(" vs");
l4=new JLabel(" vs");
l5=new JLabel(" vs");
l6=new JLabel(" vs");
l7=new JLabel(" vs");
l8=new JLabel(" vs");



t1=new JTextField(15);
t2=new JTextField(15);
t3=new JTextField(15);
t4=new JTextField(15);
t5=new JTextField(15);
t6=new JTextField(15);
t7=new JTextField(15);
t8=new JTextField(15);
t9=new JTextField(15);
t10=new JTextField(15);
t11=new JTextField(15);
t12=new JTextField(15);
t13=new JTextField(15);
t14=new JTextField(15);
t15=new JTextField(15);
t16=new JTextField(15);
t1.setEnabled(false);
t2.setEnabled(false);
t3.setEnabled(false);
t4.setEnabled(false);
t5.setEnabled(false);
t6.setEnabled(false);
t7.setEnabled(false);
t8.setEnabled(false);
t9.setEnabled(false);
t10.setEnabled(false);
t11.setEnabled(false);
t12.setEnabled(false);
t13.setEnabled(false);
t14.setEnabled(false);
t15.setEnabled(false);
t16.setEnabled(false);


b1=new JButton("DRAW");
b2=new JButton("CLEAR");
b3=new JButton("EXIT");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
f.setLayout(new GridLayout(9,3));
f.setVisible(true);
f.setSize(300,300);
f.add(t1);
f.add(l1);
f.add(t2);
f.add(t3);
f.add(l2);
f.add(t4);
f.add(t5);
f.add(l3);
f.add(t6);
f.add(t7);
f.add(l4);
f.add(t8);
f.add(t9);
f.add(l5);
f.add(t10);
f.add(t11);
f.add(l6);
f.add(t12);
f.add(t13);
f.add(l7);
f.add(t14);
f.add(t15);
f.add(l8);
f.add(t16);

f.add(b1);
f.add(b2);
f.add(b3);
f.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e1){System.exit(0);}});
}
public void actionPerformed (ActionEvent e){
String name[]={"(1001)ZHANG NING","(1002)ZHU LIN","(1003)WONG MEW CHOO","(1004)JULIA WONG",
"(1005)PI HONG YAN","(1006)WANG CHEN","(1007)SAINAL NEHWAL","(1008)LI LI","(1009)LYDIA CHEAH",
"(1010)KAORI MORI","(1011)ERIKO HIROSE","(1012)SARA PERSSON","(1013)TINE RASMUSSEN","BYE1","BYE2","BYE3"};


for (int i=0; i<name.length; i++) {
int randomPosition = (int)(Math.random()*(name.length));
String temp = name[i];
name[i] = name[randomPosition];
name[randomPosition] = temp;
}

if (e.getSource()==b1){
t1.setText(name[0]);
t2.setText(name[1]);
t3.setText(name[2]);
t4.setText(name[3]);
t5.setText(name[4]);
t6.setText(name[5]);
t7.setText(name[6]);
t8.setText(name[7]);
t9.setText(name[8]);
t10.setText(name[9]);
t11.setText(name[10]);
t12.setText(name[11]);
t13.setText(name[12]);
t14.setText(name[13]);
t15.setText(name[14]);
t16.setText(name[15]);

}
else if(e.getSource()==b2){
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
t6.setText("");
t7.setText("");
t8.setText("");
t9.setText("");
t10.setText("");
t11.setText("");
t12.setText("");
t13.setText("");
t14.setText("");
t15.setText("");
t16.setText("");

}
else
System.exit(0);
}
public static void main (String args[]){
drawapplet d=new draw();
}
}






where should i put
public void init() {}
public void start() {}
public void stop() {}
public void destroy() {}

thanks a lot

chris88
07-20-2009, 04:06 PM
any1 can help? seriusly need it
thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum