TecladoCelular.java

   1 /**
   2  * TecladoCelular.java
   3  * 
   4  * @author Luis Alejandro Bernal Romero
   5  *
   6  * Ejemplifica como poner widgets en un GridLayout
   7  */
   8 
   9 import java.awt.*;
  10 
  11 public class TecladoCelular {
  12         public static void main(String[] args) {
  13                 Frame marco = new Frame("Teclado celular");
  14                 Button[] boton = new Button[10];
  15                 for(int i = 0; i< 10; i++){
  16                         boton[i] = new Button("" + i);
  17                 }
  18                 Button botonAsterisco = new Button("*");
  19                 Button botonNumero = new Button("#");
  20                 marco.setLayout(new GridLayout(4,3));
  21                 for(int i = 1; i < 10; i++){
  22                         marco.add(boton[i]);
  23                 }
  24                 marco.add(botonAsterisco);
  25                 marco.add(boton[0]);
  26                 marco.add(botonNumero);
  27                 marco.setSize(200, 200);
  28                 marco.setVisible(true);
  29         }
  30 }

CategoryJava | CategoryProgramacion

Programas/TecladoCelular.javaConArreglos (last edited 2008-04-20 14:39:11 by localhost)