SHARE
TWEET

Untitled

a guest Mar 21st, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.awt.Button;
  2. import java.awt.Color;
  3. import java.awt.Font;
  4. import java.awt.Frame;
  5. import java.awt.GridLayout;
  6. import java.awt.Panel;
  7. import java.awt.event.ActionEvent;
  8. import java.awt.event.ActionListener;
  9.  
  10. public class Safe52 extends Frame implements ActionListener {
  11.     Button[] buttons= new Button [12];
  12.     Safe52() {
  13.         setTitle("Safe52 ");
  14.         for (int i = 0; i < 12; i++) {
  15.             if(i==4|| i==7 )
  16.             {
  17.                 buttons[i] = new Button ("");
  18.                 buttons[i].setFont(new Font("Courier", Font.BOLD, 34));
  19.                 buttons[i].addActionListener( this );
  20.                 System.out.println("gol");
  21.                
  22.                
  23.             }
  24.             else {
  25.                
  26.             buttons[i] = new Button (""+i);
  27.             buttons[i].setFont(new Font("Courier", Font.BOLD, 34));
  28.             buttons[i].addActionListener( this );
  29.             System.out.println(i);}
  30.  
  31.         }
  32.         Panel panel0 = new Panel ();
  33.         Panel panelRest = new Panel ();
  34.         panelRest.setLayout( new GridLayout(4,3) );
  35.         for (int i=0; i < 10; i++){
  36.             panelRest.add (buttons[i]);
  37.         }
  38.         add (panel0);
  39.         add (panelRest);
  40.         setSize(500, 500);
  41.         setLocation(500, 500);
  42.         addWindowListener( new WindowQuitter() );
  43.         setVisible(true);}
  44.  
  45.    
  46.  
  47.     public static void main(String[] args) {
  48.         Safe52 safe52=new Safe52();
  49.  
  50.     }
  51.  
  52.     @Override
  53.     public void actionPerformed(ActionEvent arg0) {
  54.         // TODO Auto-generated method stub
  55.        
  56.     }
  57.  
  58. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top