codigo de la figura mostrada
import java.awt.*;
import java.awt.event.*;
public class Ventana2 extends Frame {
//---------------------------------------------------------------
public Ventana2 (String titulo, int x, int y){
super(titulo);
setSize(x,y);
andeMenu();
setVisible(true);
}
//----------------------------------------------------------------
public void andeMenu(){
MenuBar mb;
Menu m1, m2;
MenuItem mi1_1, mi1_2;
CheckboxMenuItem mi2_1;
//............................................
mb=new MenuBar();
setMenuBar(mb);
m1=new Menu("Menu 1", true);
mb.add(m1);
mi1_1=new MenuItem("Menu item 1_1");
m1.add(mi1_1);
mi1_2=new MenuItem("Menu item 1_2");
m1.add(mi1_2);
//............................................
m2=new Menu("Menu 2", true);
mb.add(m2);
mi2_1=new CheckboxMenuItem("Menu item 2_1", true);
m2.add(mi2_1);
}
/
public static void main (String[] args){
Ventana2 miVentana1=new Ventana2("Una ventana", 300, 150);
miVentana1.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
}
No hay comentarios:
Publicar un comentario