Ejercicio 19.
import java.awt.*;
import java.awt.event.*;
public class ScrollPanel1 extends Frame {
public ScrollPanel1(String titulo, int x, int y){
super("opciones de scroll panel");
setSize(x,y);
setVisible(true);
setLayout(new FlowLayout());
}
public void AgregarPanelScroll(){
ScrollPane panel=new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
Panel otroPanel=new Panel();
otroPanel.setLayout(new GridLayout(7,4));
otroPanel.add(new Button("nombre 1"));
otroPanel.add(new Button("direccion 2"));
otroPanel.add(new Button("ingresar3 "));
otroPanel.add(new Button("salir 4"));
panel.add(otroPanel);
add(panel);
validate();
}
public static void main (String[] args){
ScrollPanel1 miVentana=new ScrollPanel1("Ventana scroll", 400,450);
miVentana.AgregarPanelScroll();
miVentana.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
}
No hay comentarios:
Publicar un comentario