Lucky Coupon Codes Application in java

Lucky Coupon:

A simple java application to get the lucky coupon from all numbers.The most of the peoples are use to get lottery using manually but here I am developed one simple application in java that helpful to get lucky coupon from all the numbers.
Just you will provide starting coupon and ending coupon number and it will give you a lucky coupon who won the prize of that contest. See the below screen shots to get brief idea about it.



Lucky Coupon
Lucky Lottery


lucky Player
LuckyCoupon

 See the below code to get this player in java.
LuckyPlayer.java
import java.awt.Container;
import java.awt.Font;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;


public class LuckyPlayer extends JFrame implements ActionListener{
 Player p1;
 JTextField start,end;
 JLabel startLabel,endLabel;
 JButton click;
 Container c;
 /**
  * @author Muni gangadharam
  * @version 1.0
  * */
 public LuckyPlayer() throws HeadlessException {
  c=getContentPane();
  //Font f=new Font("Courier", Font.BOLD,25);
  c.setLayout(null);
  Font f1=new Font("Consolas",Font.ITALIC,20);
  c.setFont(f1);
  start=new JTextField();
  end=new JTextField();
  startLabel=new JLabel("Enter Starting Coupon Number");
  endLabel=new JLabel("Enter Ending Coupon Number    ");
  click=new JButton("Lucky Click");
  startLabel.setBounds(20, 30, 330,52);
  start.setBounds(380, 30, 120, 52);
  endLabel.setBounds(20, 83, 330, 52);
  end.setBounds(380, 83, 120, 52);
  click.setBounds(100, 138, 200, 52);
  /** 
   * Font Setup to all components
   * 
   * */
  start.setFont(f1);   end.setFont(f1);
  startLabel.setFont(f1);  endLabel.setFont(f1);
  click.setFont(f1);
  add(end); c.add(endLabel); c.add(start); c.add(startLabel);c.add(click);
  click.addActionListener(this);
  
 }
 

 @Override
 public void actionPerformed(ActionEvent e) {
  if(e.getSource()==click){
   p1=new Player(Integer.parseInt(start.getText()),Integer.parseInt(end.getText()));
   Thread t1=new Thread(p1);
   t1.start();
   
  }
  
 }


 public static void main(String[] args) {
  LuckyPlayer lp=new LuckyPlayer();
  lp.setTitle("Lucky Player");
  lp.setVisible(true);
  lp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  lp.setSize(520, 400);

 }

}





Player.java
import java.awt.Container;
import java.awt.Font;
import java.awt.HeadlessException;

import javax.swing.JFrame;
import javax.swing.JLabel;
/**
 * @author Muni gangadharam
 * @version 1.0
 * */

public class Player extends JFrame implements Runnable {
 private static final long serialVersionUID = 1L;
 Container c;
 JLabel result;
 int result1,sNumber,eNumber;
 
 public Player(int startNumber,int endNumber) throws HeadlessException {
  sNumber=startNumber;
  eNumber=endNumber;
  c=getContentPane();
  Font f1=new Font("Consolas",Font.ITALIC,150);
  c.setLayout(null);
  result = new JLabel("");
  result.setBounds(30,30, 500,400);
  result.setFont(f1);
  setSize(600, 500);
  setVisible(true);
  c.add(result);
  setTitle("Lucky Cooupon");
  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
 }
 @Override
 public void run() {
  for(int k=0;k<=200;k++){
   result1=(int)Math.floor(Math.random()*(eNumber-sNumber)+sNumber);
   
   result.setText(result1+"");
   //repaint();
   //str=null;
   try{   
   
   Thread.sleep(100); 
   //str="Lucky Number is:"+result;
   }
   catch(Exception e){
    e.printStackTrace();
   }
  }
  
 }
 
 
}



Step1; Copy the LuckyPlayer.java ,Player.java code and save it as same as i'm provided names. Step2: Then Compile that java files and run it. Step3: provide the required fields in the windows and see the magic.