Jodbc

Páginas: 2 (269 palabras) Publicado: 14 de noviembre de 2012
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

// PRIMERO HACEMOS NUESTRA VENTANA PRINCIPAL, ES DECIR, LA QUE CONTENDRA A LAS
// VENTANAS

public class pruebaventanaextends JApplet {

static JDesktopPane Desktop = null; // ESTE OBJETIVO CONTIENE A LOS JInternalFrame
JButton crear = new JButton("crear ventana");

JPanel principal = new JPanel(newBorderLayout());
JPanel boton = new JPanel(new FlowLayout());

public pruebaventana(){

Desktop = new JDesktopPane(); // ISTANCIAMOS EL OBJETO

// AL PANEL boton, AGREGAMOS EL BOTON crearboton.add(crear);

principal.add(boton,BorderLayout.NORTH);
principal.add(Desktop,BorderLayout.CENTER);

getContentPane().add(principal);

setSize(500,500);

// EVENTO QUE OCURRE ALPRESIONAR EL BOTON DE CREAR LA VENTANA
crear.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent evt){
crearVentana();
}



});

}//FIN DEL CONSTRUCTORDE LA CLASE PRINCIPAL

//EL SIGUIENTE CODIGO,INSTANCIA LA CLASE ventana,LA CUAL ES LA PRESENTACION
// DE LA VENTANAS INTERNAS A TRABAJAR....."

public void crearVentana() {

Ventanaframe = new Ventana();
frame.setVisible(true); // NECESARIO PARA QUE SE MUESTRE
Desktop.add(frame); // AGREGO LA NUEVA VENTANA AL CONTENEDOR DE VENTANAS INTERNAS
try{frame.setSelected(true);
}catch(Exception e){
JOptionPane.showMessageDialog(null,e.getMessage(),"Error",JOptionPane.OK_OPTION);
}
}

} // FIN DE LA CLASE PRINCIPAL

// A CONTINUACION,HACEMOS LA CLASE QUE REPRESENTARA A LAS VENTANAS INTERNAS
class Ventana extends JInternalFrame{

public static int numVentana = 1;
public static int x = 45, y = 45;

public Ventana(){super("Ventana #" + (numVentana), // titulo de la ventana

true, // resizable
true, // closable
true, // maximizable
true); // iconifiable

setSize(300,200); // EL TAMAÑO QUE TENDRA...
Leer documento completo

Regístrate para leer el documento completo.

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS