Topicos selectos de programacion

Páginas: 24 (5826 palabras) Publicado: 20 de junio de 2010
INSTITUTO TECNOLOGICO
SUPERIOR DE HUATUSCO

NOMBRE DEL ALUMNO:
MARÍA GUADALUPE NAMORADO MORALES

NOMBRE DE LA MATERIA:
TOPICOS SELECTOS DE PRGRAMACIÓN

NOMBRE DEL DOCENTE:
ING.JUAN MANUEL GONZÁLEZ SOBAL

PROGRAMAS
UNIDAD I
UNIDAD II
Unidad I
Manejadores de Capas
1.- FlowLayout

import javax.swing.*;
import java.awt.*;
public classEjercicioFL extends JFrame {
JButton alumno;
JButton maestro;
JButton escuela;
JButton materia;
public EjercicioFL () {
super.setTitle("FlowLayout");
FlowLayout u= new FlowLayout();
this.setLayout(u);
alumno=new JButton("ALUMNO");
maestro=new JButton("MAESTRO");
escuela=new JButton("ESCUELA");
materia=newJButton("MATERIA");

this.add(alumno);
this.add(maestro);
this.add(escuela);
this.add(materia);

this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setSize(210, 140);
}
public static void main(String[] args) {
EjercicioFL u=new EjercicioFL();
u.setVisible(true);
}
}// fin de la CapaFlowLayout
2.- BorderLayout

import java.awt.*;
import javax.swing.*;
public class EjercicioBL extends JFrame {
public EjercicioBL() {
super.setTitle("BorderLayout");
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.add( new Button( "Sur" ),"South" );
this.add( new Button( "Oeste" ),"West" );
this.add( new Button( "Este" ),"North" );this.add( new Button( "Boton del Este" ),"East" );
this.add( new Button( "Centro" ),"Center" );
this.setSize( 260,160 );
this.setVisible( true );
}

public static void main( String []args ) {
EjercicioBL x = new EjercicioBL();
x.setVisible(true);
}
}//Fin de BorderLayout
3.- GridLayout

import java.awt.*;
importjava.awt.event.*;
import javax.swing.*;
public class EjercicioGL extends JFrame implements ActionListener {
private JButton botones[];
private final String nombres[] =
{ "1", "2", "3", "4", "5", "6" };
private boolean alternar = true;
private Container contenedor;
private GridLayout cuadricula1, cuadricula2;
// configurar GUI
public EjercicioGL()
{super( "Ejemplo GridLayout" );

cuadricula1 = new GridLayout( 2, 3, 10, 10 );
cuadricula2 = new GridLayout( 3, 2 );

contenedor = getContentPane();
contenedor.setLayout( cuadricula1 );
botones = new JButton[ nombres.length ];
for ( int cuenta = 0; cuenta < nombres.length; cuenta++ ) {
botones[ cuenta ] = new JButton( nombres[ cuenta] );
botones[ cuenta ].addActionListener( this );
botones[ cuenta ].setToolTipText("Cambia el esquema de GridLayout");
contenedor.add( botones[ cuenta ] );
}
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setSize( 300, 150 );

}

public void actionPerformed( ActionEvent evento ) {
if ( alternar )contenedor.setLayout( cuadricula2 );
else
contenedor.setLayout( cuadricula1 );

alternar = !alternar;
contenedor.validate();
}

public static void main( String args[] )
{
EjercicioGL x = new EjercicioGL();
x.setVisible(true);
}
}//Fin de la Capa GridLayout
4.- BoxLayout

import java.awt.*;
import javax.swing.*;
public classEjercicioGBL extends JFrame {
public EjercicioGBL()
{
super( "Demo de BoxLayout" );
// crear contenedores Box con esquema BoxLayout
Box horizontal1 = Box.createHorizontalBox();
Box vertical1 = Box.createVerticalBox();
Box horizontal2 = Box.createHorizontalBox();
Box vertical2 = Box.createVerticalBox();
final int TAMANIO = 3; //...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Resumen unidad 1 de tópicos selectos de programación
  • Topicos selectos de programacion
  • Topicos Selectos De Ti
  • Tópicos selectos
  • Topico selecto
  • Tópicos selectos
  • Topicos de Programacion
  • Topicos selectos de la computacio

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS