Wednesday, March 18, 2009

Exercise3- Combination Lock

/*Programmer: Miexie D. Tulid
 *Date started: March 13, 2009
 *Date ended: March 18, 2009
 *Description: A program that used number buttons from 0-9, and once the user clicked three correct
 *unlocked combination, the program will exit, otherwise its background will turn to red.*/

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

public class CombinationLock extends JFrame {

public static void main (String [] args) {
  new CombinationLock().setVisible(true);
  }

public CombinationLock () {

  Container cp = getContentPane();
  cp.setLayout(new FlowLayout());

   
  cp.add(new JButton("0"));
  cp.add(new JButton("1"));
  cp.add(new JButton("2"));
  cp.add(new JButton("3"));
  cp.add(new JButton("4"));
  cp.add(new JButton("5"));
  cp.add(new JButton("6"));
  cp.add(new JButton("7"));
  cp.add(new JButton("8"));
  cp.add(new JButton("9"));
  cp.setBackground(Color.white);
  pack();
   

  }
}

1 comment:

  1. check my site www.sipedronasa.blogspot.com....give me advice for the design of my blog write it thru comments ....thanks

    ReplyDelete