Advertisement
Guest User

LottoWheel.java

a guest
May 25th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package tarekeselotto;
  7.  
  8. import java.awt.GridLayout;
  9. import javax.swing.JFrame;
  10. import javax.swing.JLabel;
  11.  
  12. /**
  13.  *
  14.  * @author isonuZ
  15.  */
  16. public class LottoWheel extends JFrame {
  17.   public Ball[] balls = new Ball[7];
  18.   int[] result = new int[7];
  19.  
  20.   public LottoWheel() {
  21.     initBalls();
  22.    
  23.     setLayout(new GridLayout(1, 8));
  24.    
  25.     for(int i=0; i < 6; i++) {
  26.       add(balls[i]);
  27.     }
  28.    
  29.     add(new JLabel(" "));
  30.     add(balls[6]);
  31.    
  32.     for(int i=0; i<balls.length; i++) {
  33.       result[i] = balls[i].getValue(result, i);
  34.     }
  35.    
  36.     for(int r : result) {
  37.       System.out.print(r + " ");
  38.     }
  39.   }
  40.  
  41.   public static void main(String[] args) {
  42.     LottoWheel frame = new LottoWheel();
  43.     frame.setLocationRelativeTo(null); // Center the frame
  44.     frame.setSize(600, 80); //w, h
  45.     frame.setVisible(true);
  46.   }
  47.  
  48.   private void initBalls() {
  49.     for(int i=0; i < balls.length; i++) {
  50.       balls[i] = new Ball();
  51.     }
  52.   }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement