Exercise 3: Lock Combination
/*Programmer:Rosedil Mae P. Mobreros
*Date started: March 14, 2009
*Date ended: March 18, 2009
*Purpose: To create a program that uses number buttons from 0-9, when the user clicked three correct unlocked combination, the program will exit, hence its background will turn to red.*/
import javax.swing.*;
import java.awt.*;
public class LockCombination extends JFrame
{
public static void main (String [] args)
{
new LockCombination ().setVisible(true);
}
public LockCombination ()
{
Container roxy = getContentPane();
roxy.setLayout(new FlowLayout());
roxy.add(new JButton("0"));
roxy.add(new JButton("1"));
roxy.add(new JButton("2"));
roxy.add(new JButton("3"));
roxy.add(new JButton("4"));
roxy.add(new JButton("5"));
roxy.add(new JButton("6"));
roxy.add(new JButton("7"));
roxy.add(new JButton("8"));
roxy.add(new JButton("9"));
roxy.setBackground(Color.white);
pack();
}
}
Wednesday, March 18, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment