Awt y swing

Páginas: 2 (334 palabras) Publicado: 10 de septiembre de 2012
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.Color;
import java.awt.Button;
import java.awt.Panel;
import java.awt.Label;

class Ventana
{


public voidiniciar()
{
int a=0;
int b=0;
int c=100;
int d=100;

for(int i=0 ; i<=20; i++)
{
if (i % 2 == 0)
{
Frame frame = new Frame();
frame.setVisible(true);frame.setSize(c,d);
frame.setLocation(a,b);
frame.setTitle("Formulario");
frame.setBackground(Color.BLUE);

Button b1 =new Button("boton 1");
Button b2 =new Button("boton 2");
Label l1 = newLabel("Pantalla 1");
Label l2 = new Label("1");

Panel p=new Panel();
Panel p2= new Panel();
Panel p3= new Panel();
Panel p4= new Panel();
Panel p5= new Panel();p.setBackground(Color.BLUE);
p2.setBackground(Color.BLUE);
p3.setBackground(Color.GRAY);
p4.setBackground(Color.YELLOW);
p5.setBackground(Color.YELLOW);

p.add(b1);
p.add(b2);p2.add(l1);
p2.add(l1);

p3.add(l2);


frame.add("South",p);
frame.add("North",p2);
frame.add("Center",p3);
frame.add("West",p4);
frame.add("East",p5);
a=a+30;
b=b+30;c=c+10;
d=d+10;
}else
{
Frame frame = new Frame();
frame.setVisible(true);
frame.setSize(c,d);
frame.setLocation(a,b);
frame.setTitle("Formulario");
frame.setBackground(Color.BLUE);Button b1 =new Button("boton 1");
Button b2 =new Button("boton 2");
Label l1 = new Label("Pantalla 1");
Label l2 = new Label("1");

Panel p=new Panel();
Panel p2= new Panel();Panel p3= new Panel();
Panel p4= new Panel();
Panel p5= new Panel();

p.setBackground(Color.YELLOW);
p2.setBackground(Color.YELLOW);
p3.setBackground(Color.GRAY);p4.setBackground(Color.BLUE);
p5.setBackground(Color.BLUE);

p.add(b1);
p.add(b2);

p2.add(l1);
p2.add(l1);

p3.add(l2);


frame.add("South",p);
frame.add("North",p2);...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • AWT y Swing
  • Awt Y Swing
  • Swing Y Awt
  • DIFERENCIA ENTRE AWT Y SWING
  • Awt, Swing & Excepciones En Java
  • Reporte de modo grafico awt swing
  • AWT
  • Swing

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS