Buscar este blog

jueves, 25 de abril de 2013

EJERCICIOS JAVA SWING

package FSWING2;
import java.awt.BorderLayout;
import java.awt.GridLayout;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class Ejercicio1 {

    public static void main(String[] args) {
        JFrame Ventana = new JFrame();
        Ventana.setTitle("Ejercicio 1");
         JPanel general= new JPanel(new BorderLayout());
          JPanel panela = new JPanel(new GridLayout(2,1));
          JPanel panelb = new JPanel();
          JPanel panelc = new JPanel();
          JPanel Pcombo = new JPanel();
          JPanel Plabel = new JPanel();
         
          JLabel etiqueta = new JLabel("Seleccionar imagen en el JComboBox");
          etiqueta.setForeground(java.awt.Color.red);
         
          String[] lista = { "SELECCIONE" };
          JComboBox combo = new JComboBox(lista);
         
          JLabel imagen = new JLabel(); 
          imagen.setIcon(new ImageIcon("src/FSWING2/logo.jpg"));
         
          JButton boton1 = new JButton("SALIR");
          JButton boton2 = new JButton("ALUMNO: ");
          JTextField text = new JTextField("",10);
          text.setBackground(java.awt.Color.blue);

         
          Plabel.add(etiqueta);
          Pcombo.add(combo);
          panela.add(Plabel);
          panela.add(Pcombo);
         
          panelb.add(boton1);
          panelb.add(boton2);
          panelb.add(text);
         
          panelc.add(imagen);

          Ventana.add(general);
          general.add(panela, BorderLayout.NORTH);
          general.add(panelc, BorderLayout.CENTER);
          general.add(panelb, BorderLayout.SOUTH);
         
          Ventana.setSize(400, 400);
          Ventana.setTitle("Combobox jlabel");
          Ventana.setVisible(true);
         }}

package FSWING2;
import java.awt.*;
import javax.swing.*;

public class Ejercicio2 {
    public static void main(String[] args) {
        JFrame Ventana = new JFrame();
        Ventana.setTitle("Ejercicio 2");
        Ventana.setSize(400,300);
        JPanel Panel=new JPanel(new BorderLayout());
        JToolBar Barra= new JToolBar();
        JButton Cortar= new JButton(new ImageIcon("src/FSWING2/cortar.jpg"));
        Barra.add(Cortar);
        JButton Copiar= new JButton(new ImageIcon("src/FSWING2/copiar.jpg"));
        Barra.add(Copiar);
        JButton Pegar= new JButton(new ImageIcon("src/FSWING2/pegar.jpg"));
        Barra.add(Pegar);
        Panel.add(Barra, BorderLayout.NORTH);
        Ventana.add(Panel);
        Ventana.setVisible(true);
    }}

package FSWING2;
import java.awt.*;
import javax.swing.*;
import javax.swing.JFrame;

public class Ejercicio3 {
    public static void main(String[] args) {
        JFrame Ventana = new JFrame();
        Ventana.setTitle("Ejercicio 3");
        Ventana.setSize(400,300);
        JPanel Grande=new JPanel(new BorderLayout());
        JPanel Derecha=new JPanel();
        Derecha.setLayout(new BoxLayout(Derecha,BoxLayout.Y_AXIS));
        JButton ABT1=new JButton("Boton 1");
        JButton ABT2=new JButton("Boton 2");
        JButton ABT3=new JButton("Boton 3");
        JButton ABT4=new JButton("Boton 4");
        Derecha.add(ABT1);
        Derecha.add(ABT2);
        Derecha.add(ABT3);
        Derecha.add(ABT4);
        JPanel Debajo=new JPanel();
        Debajo.setLayout(new BoxLayout(Debajo,BoxLayout.X_AXIS));
        JButton BBT1=new JButton("Boton 1");
        JButton BBT2=new JButton("Boton 2");
        JButton BBT3=new JButton("Boton 3");
        JButton BBT4=new JButton("Boton 4");
        Debajo.add(BBT1);
        Debajo.add(BBT2);
        Debajo.add(BBT3);
        Debajo.add(BBT4);
        Grande.add(Derecha,BorderLayout.EAST);
        Grande.add(Debajo,BorderLayout.SOUTH);
        Ventana.add(Grande);
        Ventana.setVisible(true);
    }}

package FSWING2;

    import javax.swing.*;
    import java.awt.*;

    public class Ejercicio4 {

    public static void main(String[] args) {

    JFrame Ventana = new JFrame();

    JPanel General = new JPanel();
    SpringLayout lay = new SpringLayout();
    General.setLayout(lay);

    JButton boton1 = new JButton("Press 1");
    JButton boton2 = new JButton("Press 2");
    JButton boton3 = new JButton("Press 3");
    JButton boton4 = new JButton("Press 4");
    JButton boton5 = new JButton("Press 5");
    JButton boton6 = new JButton("Press 6");

    lay.putConstraint(SpringLayout.NORTH,boton1,50, SpringLayout.WEST,General);
    lay.putConstraint(SpringLayout.WEST,boton1,150, SpringLayout.WEST,General);

    lay.putConstraint(SpringLayout.NORTH,boton2,100, SpringLayout.WEST,General);
    lay.putConstraint(SpringLayout.WEST,boton2,100, SpringLayout.WEST,General);

    lay.putConstraint(SpringLayout.NORTH,boton3,100, SpringLayout.WEST,General);
    lay.putConstraint(SpringLayout.WEST,boton3,200, SpringLayout.WEST,General);

    lay.putConstraint(SpringLayout.NORTH,boton4,150, SpringLayout.WEST,General);
    lay.putConstraint(SpringLayout.WEST,boton4,50, SpringLayout.WEST,General);

    lay.putConstraint(SpringLayout.NORTH,boton5,150, SpringLayout.WEST,General);
    lay.putConstraint(SpringLayout.WEST,boton5,150, SpringLayout.WEST,General);

    lay.putConstraint(SpringLayout.NORTH,boton6,150, SpringLayout.WEST,General);
    lay.putConstraint(SpringLayout.WEST,boton6,250, SpringLayout.WEST,General);

    Ventana.add(General);
    General.add(boton1);
    General.add(boton2);
    General.add(boton3);
    General.add(boton4);
    General.add(boton5);
    General.add(boton6);

    Ventana.setVisible(true);
    Ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Ventana.setSize(400,250);
    }}

ALTER TABLE EN SQL

ALTER TABLE _____ ADD ___ (formato);
Modificar la estructura de una tabla.
alter table libros add cantidad smallint unsigned not null;
ALTER TABLE ____ DROP____;
Eliminar un campo de una tabla.
alter table libros drop editorial;
ALTER TABLE ____ MODIFY ____ (formato);
Modificar el tipo de algún campo incluidos sus atributos.
alter table libros modify titulo varchar (40) not null;
ALTER TABLE _____ CHANGE ___ (formato);
Modificar el nombre de los campos de una tabla.
alter table libros change coste precio decimal (5,2);
ALTER TABLE  ____ ADD PRIMARY KEY (_____);
agregar una clave primaria a una tabla existente.
alter table libros add primary key (codigo);
ALTER TABLE ____ DROP PRIMARY KEY (____);
Eliminar la clave primaria de una tabla existente.
alter table libros drop primary key;

ALTER TABLE: modifica la estructura de una tabla.
AÑADIR: alter table libros add cantidad smallint unsigned not null;
ELIMINAR: alter table libros drop edicion;
MODIFICAR: alter table libros modify cantidad smallint unsigned;
CAMBIAR NOMBRE DEL CAMPO:alter table libros change coste precio decimal (5,2);
AGREGAR CLAVE PRIMARIA: 1.- alter table libros add primary key (codigo);
            2.- alter table libros modify codigo int unsigned auto_increment;
ELIMINAR CLAVE PRIMARIA:1.-alter table libros modify codigo int unsigned;
            2.-alter table libros drop primary key;
RENOMBRAR TABLA: alter table amigos rename contact; // rename table amigos to contactos; 

domingo, 21 de abril de 2013

PROGRAMACION ENTORNO GRAFICO EN JAVA (AWT).


package EJERCICIOS1MARCO;
import java.awt.*;
import java.awt.event.*;
public class ejercicio1 {
       static Frame ventana = new Frame();
       public static void main (String [] args)
       {
             ventana.setTitle("Mi Programa");
             ventana.setBackground(java.awt.Color.pink);
             ventana.setSize(200, 250);
             ventana.setVisible(true);
                    ventana.addWindowListener(new WindowAdapter(){
                           public void windowClosing(WindowEvent we){
                                  System.exit(0);
                           }
                    });
       }
}
ackage EJERCICIOS1MARCO;
import java.awt.*;
import java.awt.event.*;
public class Ejercicio2 {
       static Frame ventana = new Frame();
       static Frame ventana2 = new Frame();
       static Frame ventana3 = new Frame();
       public static void main (String [] args)
       {
             ventana.setTitle("Mi Programa");
             ventana.setBackground(java.awt.Color.yellow);
             ventana.setSize(100, 125);
             ventana.setLocation(100, 100);
             ventana.setVisible(true);
                    ventana2.setTitle("Mi Programa2");
                    ventana2.setBackground(java.awt.Color.blue);
                    ventana2.setSize(200, 250);
                    ventana2.setLocation(300, 300);
                    ventana2.setVisible(true);
                           ventana3.setTitle("Mi Programa3");
                           ventana3.setBackground(java.awt.Color.green);
                           ventana3.setSize(400, 500);
                           ventana3.setLocation(700, 200);
                           ventana3.setVisible(true);
                          
             ventana.addWindowListener(new WindowAdapter(){
                           public void windowClosing(WindowEvent we){
                                  System.exit(0);
                           }});
                    ventana2.addWindowListener(new WindowAdapter(){
                           public void windowClosing(WindowEvent we){
                                  System.exit(0);
                           }});
            
                           ventana3.addWindowListener(new WindowAdapter(){
                                  public void windowClosing(WindowEvent we){
                                        System.exit(0);
                                  }});
       }}

package EJERCICIOS2PANELES;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class ejercicio2 extends Panel{
ejercicio2(){
       setBackground(Color.white);
}
public void paint(Graphics g)
{g.drawRect(5,5,getWidth()-10,getHeight()-10);}
       public Dimension getPreferredSize()
{ return new Dimension (120,90)}
       public static void main (String[]args){
             Frame ventana = new Frame();
             ejercicio2 panelnorte = new ejercicio2();
             ejercicio2 paneloeste = new ejercicio2();
             ejercicio2 panelcentro = new ejercicio2();
             ejercicio2 paneleste = new ejercicio2();
             ejercicio2 panelsur = new ejercicio2();
ventana.setVisible(true);
             ventana.add(panelnorte, "North");        //Panel de arriba
             ventana.add(paneloeste, "West");        //Panel izquierda
             ventana.add(panelcentro, "Center");            //Panel central
             ventana.add(paneleste, "East");                //Panel derecha
             ventana.add(panelsur, "South");                //Panel sur
             ventana.pack();
             ventana.addWindowListener(new WindowAdapter(){
                    public void windowClosing(WindowEvent we){
                           System.exit(0);}});
}}

package EJERCICIOS3LAYOUTS;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Ejercicio1 {
             public static void main (String [] args){
                    Frame ventana= new Frame();
                    Panel panel = new Panel(new FlowLayout());
                    Button boton1 = new Button("hola");
                    Button boton2 = new Button("adios");
                    Button boton3 = new Button("etiqueta larga");
                    Button boton4 = new Button("1");
                    Button boton5 = new Button("2");
                    Button boton6 = new Button("3");
                    ventana.add(panel);
                    panel.add(boton1);
                    panel.add(boton2);
                    panel.add(boton3);
                    panel.add(boton4);
                    panel.add(boton5);
                    panel.add(boton6);
                    ventana.pack();
                    ventana.setVisible(true);
                    ventana.addWindowListener(new WindowAdapter(){
                           public void windowClosing(WindowEvent we){
                                  System.exit(0);}});
             }}
package EJERCICIOS3LAYOUTS;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class EJERCICIO2LAYOUT {
       public static void main(String[] args) {
       Frame MiMarco =new Frame();
             Panel MiPanel = new Panel(new BorderLayout());
             MiMarco.add(MiPanel);
             Button BotonNorte = new Button("NORTE");
             Button BotonOeste = new Button("OESTE");
             Button BotonCentro = new Button("CENTRO");
             Button BotonEste = new Button("ESTE");
             Button BotonSur = new Button("SUR");
             MiPanel.add(BotonNorte, BorderLayout.NORTH);
             MiPanel.add(BotonOeste, BorderLayout.WEST);
             MiPanel.add(BotonCentro, BorderLayout.CENTER);
             MiPanel.add(BotonEste, BorderLayout.EAST);
             MiPanel.add(BotonSur, BorderLayout.SOUTH);
             MiMarco.pack();
             MiMarco.setVisible(true);
             MiMarco.addWindowListener(new WindowAdapter(){
                    public void windowClosing(WindowEvent we){
                           System.exit(0);
                    }});
       }}
package EJERCICIOS4COMPONENTES;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
class Ejercicio4 {
             public static void main (String [] args){
             Frame Ventana = new Frame();
             Ventana.setBackground(Color.BLUE);
             Panel General = new Panel(new GridLayout(3,1));
             Panel Arriba = new Panel(new GridLayout(3,5));
             Panel Centro = new Panel(new FlowLayout(FlowLayout.LEFT));
             Panel Calculos = new Panel(new GridLayout(2,2));
             Panel Abajo = new Panel(new FlowLayout(FlowLayout.LEFT));
             Panel Botones = new Panel(new GridLayout(2,1));
             Label Vertice1 = new Label("VERTICE 1");
             Label Vertice2 = new Label("VERTICE 2");
             Label Vertice3 = new Label("VERTICE 3");
             Label X1 = new Label("X1", Label.CENTER);
             Label X2 = new Label("X2", Label.CENTER);
             Label X3 = new Label("X3", Label.CENTER);
             Label Y1 = new Label("Y1", Label.CENTER);
             Label Y2 = new Label("Y2", Label.CENTER);
             Label Y3 = new Label("Y3", Label.CENTER);
             Label Area = new Label("AREA");
             Label Perimetro = new Label("PERIMETRO");
             TextField textX1 = new TextField(10);
             TextField textX2 = new TextField(10);
             TextField textX3 = new TextField(10);
             TextField textY1 = new TextField(10);
             TextField textY2 = new TextField(10);
             TextField textY3 = new TextField(10);
             TextField textArea = new TextField(10);
             TextField textPerimetro = new TextField(10);
             Button BotonCalcular = new Button("CALCULAR");
             Button BotonReset = new Button("RESET");
             Ventana.add(General);
             General.add(Arriba);
             Arriba.add(Vertice1);
             Arriba.add(X1);
             Arriba.add(textX1);
             Arriba.add(Y1);
             Arriba.add(textY1);
             Arriba.add(Vertice2);
             Arriba.add(X2);
             Arriba.add(textX2);
             Arriba.add(Y2);
             Arriba.add(textY2);
             Arriba.add(Vertice3);
             Arriba.add(X3);
             Arriba.add(textX3);
             Arriba.add(Y3);
             Arriba.add(textY3);
             General.add(Centro);
             Centro.add(Calculos);
             Calculos.add(Area);
             Calculos.add(textArea);
             Calculos.add(Perimetro);
             Calculos.add(textPerimetro);
             General.add(Abajo);
             Abajo.add(Botones);
             Botones.add(BotonCalcular);
             Botones.add(BotonReset);
             Ventana.setVisible(true);
             Ventana.setSize(600,230);
             Ventana.addWindowListener(new WindowAdapter(){
                    public void windowClosing(WindowEvent we){
                           System.exit(0);
                    }});
}}
package EJERCICIO5TEXTAREAYCHOICE;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Ejercicio5 {
       public static void main (String [] args){
             Frame Ventana = new Frame();
             Panel General = new Panel(new GridLayout(3,1));
             Panel Titulo = new Panel(new FlowLayout(FlowLayout.CENTER));
                    Label DatosPersonales= new Label("INGRESO DATOS PERSONALES");
             Panel Contenido = new Panel (new GridLayout(4,2));
                    Label Id = new Label("ID:");
                    TextField TextId = new TextField(10);
                    Label Nombres = new Label("Nombres:");
                    TextField TextNombres = new TextField(10);
                    Label Hobbies = new Label("Hobbies:");
                    TextArea TextHobbies = new TextArea("",2,20,TextArea.SCROLLBARS_BOTH);
                    Label Grupo = new Label ("Grupo");
                           Choice Eleccion = new Choice();
                           Eleccion.add("Amigos");
                           Eleccion.add("Trabajo");
             Panel Botones = new Panel (new FlowLayout(FlowLayout.CENTER));
                    Button BotonLimpiar = new Button("LIMPIAR");
                    Button BotonGrabar = new Button("GRABAR");
                    Button BotonSalir = new Button("SALIR");
                    Botones.add(BotonLimpiar);
                    Botones.add(BotonGrabar);
                    Botones.add(BotonSalir);
             Ventana.add(General);
                    General.add(Titulo);
                           Titulo.add(DatosPersonales);
                    General.add(Contenido);
                           Contenido.add(Nombres);
                                  Contenido.add(TextNombres);
                           Contenido.add(Hobbies);
                                  Contenido.add(TextHobbies);
                           Contenido.add(Grupo);
                                  Contenido.add(Eleccion);
                           Contenido.add(Botones);
             Ventana.setVisible(true);
             Ventana.setSize(400,300);
             Ventana.addWindowListener(new WindowAdapter(){
             public void windowClosing(WindowEvent we){
             System.exit(0);
             }});
       }}
package EJERCICIO6FONTS;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Ejercicio6 {
       public static void main(String[] args) {
             Frame MiMarco = new Frame();
              Font Fuente1 = new Font("Serif",Font.PLAIN,20);
             Font Fuente2 = new Font("SansSerif",Font.PLAIN,20);
             Font Fuente3 = new Font("Monospaced",Font.ITALIC,20);
             Font Fuente4 = new Font("Dialog",Font.BOLD,20);
             Font Fuente5 = new Font("DialogInput",Font.PLAIN,20);
             Panel ejercicioseis = new Panel(new GridLayout(5,1));
             Label Texto1=new Label("Serif");
             Label Texto2=new Label("SansSerif");
             Label Texto3=new Label("Monospaced");
             Label Texto4=new Label("Dialog");
             Label Texto5=new Label("DialogInput");
             Texto1.setFont(Fuente1);
             Texto2.setFont(Fuente2);
             Texto3.setFont(Fuente3);
             Texto4.setFont(Fuente4);
             Texto5.setFont(Fuente5);
             ejercicioseis.add(Texto1);
             ejercicioseis.add(Texto2);
             ejercicioseis.add(Texto3);
             ejercicioseis.add(Texto4);
             ejercicioseis.add(Texto5);
             MiMarco.add(ejercicioseis);
             MiMarco.setSize(500,500);
             MiMarco.setTitle("PRUEBA DE FUENTES");
             MiMarco.setVisible(true);
             MiMarco.addWindowListener(new WindowAdapter(){
                    public void windowClosing(WindowEvent we){
                    System.exit(0);
                    }});
       }}
package EJERCICIO7CHECKBOX;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Ejercicio7 {
       public static void main(String[] args) {
             Frame MiMarco = new Frame();
             Panel MiPanel = new Panel(new GridLayout(1,3));
             Panel PanelColores = new Panel(new BorderLayout());
             List Colores = new List(5);
                    Colores.add("Rojo");
                    Colores.add("Naranja");
                    Colores.add("Amarillo");
                    Colores.add("Verde");
                    Colores.add("Azul");
                    Colores.add("Morado");
                    Colores.add("Añil");
                    Colores.add("Negro");
             PanelColores.add(Colores);
                    Label VacioNorte = new Label (" ");
                    Label VacioSur = new Label (" ");
                    PanelColores.add(VacioNorte, BorderLayout.NORTH);
                    PanelColores.add(VacioSur, BorderLayout.SOUTH);
                    MiPanel.add(PanelColores, BorderLayout.CENTER);
             MiMarco.add(MiPanel);
             Panel PanelCentral =new Panel (new GridLayout(6,1));
             Label VacioCentroNorte = new Label (" ");
             PanelCentral.add(VacioCentroNorte);
             Button BotonBorrar=new Button("BORRAR");
             Button BotonImprimir=new Button("IMPRIMIR");
             PanelCentral.add(BotonBorrar);
             PanelCentral.add(BotonImprimir);
             Choice Formas = new Choice();
             Formas.add("Cuadrado");
             Formas.add("Circulo");
             Formas.add("Rombo");
             Formas.add("Triangulo");
             Formas.add("Elipse");
             PanelCentral.add(Formas);
             Checkbox Relleno = new Checkbox("Relleno", false);
             PanelCentral.add(Relleno);
             Label VacioCentroSur = new Label (" ");
             PanelCentral.add(VacioCentroSur);
             MiPanel.add(PanelCentral);
             Panel PanelEditor = new Panel (new BorderLayout());
             Label NombreDerecha = new Label ("Editor");
             PanelEditor.add(NombreDerecha,BorderLayout.NORTH);
             int FILAS= 7;
             int COLUMNAS =20;
             TextArea Editor = new TextArea("", FILAS, COLUMNAS, TextArea.SCROLLBARS_VERTICAL_ONLY);
             PanelEditor.add(Editor);
             MiPanel.add(PanelEditor);
             MiMarco.setSize(400,200);
             MiMarco.setTitle("Tutorial de Java, AWT");
             MiMarco.setVisible(true);
             MiMarco.addWindowListener(new WindowAdapter(){
             public void windowClosing(WindowEvent we){
             System.exit(0);
             }});
       }}
package EJERCICIO8CHECKBOXGROUP;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class EJERCICIO8 {
       public static void main(String[] args) {
             Frame MiMarco = new Frame();
             Panel MiPanel = new Panel(new BorderLayout());
             Panel PanelDimeNombre = new Panel(new FlowLayout());
             TextField CampoDimenombre = new TextField(12);
             Label EtiquetaDimenombre = new Label("Dime tu nombre", Label.LEFT);
             PanelDimeNombre.add(EtiquetaDimenombre,FlowLayout.LEFT);
             PanelDimeNombre.add(CampoDimenombre);
             MiPanel.add(PanelDimeNombre,(BorderLayout.NORTH));
             Panel Central =new Panel (new GridLayout(6,1));
             Label EtiquetaIntereses =new Label("Intereses");
             Checkbox Viajar = new Checkbox("Interesado en viajar.", false);
             Checkbox Deportes = new Checkbox("Aficionado a los deportes.", false);
             Label EtiquetaSexo =new Label("Sexo:");
             CheckboxGroup Sexo =new CheckboxGroup();
             Checkbox Hombre = new Checkbox("Hombre",false,Sexo);
             Checkbox Mujer = new Checkbox("Mujer",false,Sexo);
             MiPanel.add(Central,(BorderLayout.CENTER));
             Central.add(EtiquetaIntereses);
             Central.add(EtiquetaSexo);
             Central.add(Viajar);
             Central.add(Deportes);
             Central.add(EtiquetaSexo);
             Central.add(Hombre);
             Central.add(Mujer);
             Panel Abajo =new Panel();
             Label EtiquetaCiudad =new Label("Ciudad:");
             Choice Ciudades=new Choice();
             Ciudades.add("Madrid");
             Ciudades.add("Sevilla");
             Button BotonEnviar=new Button("Enviar");
             Abajo.add(EtiquetaCiudad);
             Abajo.add(Ciudades);
             Abajo.add(BotonEnviar);
             MiPanel.add(Abajo,BorderLayout.SOUTH);
             MiMarco.add(MiPanel);
             MiMarco.setSize(250,300);
             MiMarco.setTitle("Ejercicio 8 CheckBoxGroup");
             MiMarco.setVisible(true);
             MiMarco.addWindowListener(new WindowAdapter(){
             public void windowClosing(WindowEvent we){
             System.exit(0);
             }});        }}
package EJERCICIO8LIST;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Ejercicio8List {
       public static void main(String[] args) {
             Frame MiMarco = new Frame();
             Panel MiPanel = new Panel(new GridLayout(1,3));
             Panel Panel1 = new Panel();
             List Colours=new List(5,true);
             Colours.add("Black");
             Colours.add("Blue");
             Colours.add("Cyan");
             Colours.add("Dark Gray");
             Colours.add("Pink");
             Colours.add("Brown");
             Colours.add("Yellow");
             Colours.add("Green");
             Panel1.add(Colours);
             MiPanel.add(Panel1);
             Panel Panel2 =new Panel();
             Label Vacio1 = new Label("");
             Label Vacio2 = new Label("");
             Button BotonCopy=new Button("Copy > > >");
             Panel2.add(Vacio1);
             Panel2.add(Vacio2);
             Panel2.add(BotonCopy);
             MiPanel.add(Panel2);
             Panel Panel3=new Panel();
             TextArea Editor = new TextArea("", 5, 14);
             Panel3.add(Editor);
             MiPanel.add(Panel3);
             MiMarco.setSize(400,200);
             MiMarco.setTitle("Multiple Selection List");
             MiMarco.add(MiPanel);
             MiMarco.setVisible(true);
             MiMarco.addWindowListener(new WindowAdapter(){
             public void windowClosing(WindowEvent we){
             System.exit(0);
             }});  
       }}
package EJERCICIO9;
import java.awt.*;
public class Botones {Panel p3 = new Panel();
       Botones(){
             Button d1 = new Button("Limpiar");
             Button d2 = new Button("Grabar");
             Button d3 = new Button("Salir");
             p3.add(d1);
             p3.add(d2);
             p3.add(d3);}
       Panel damepanel(){
             return p3;}}
package EJERCICIO9;
import java.awt.*;
public class Contenido {
       Panel p2 = new Panel(new GridLayout(4,2));
       Contenido(){
             Panel x1 = new Panel(new FlowLayout(FlowLayout.LEFT));
             Label b1 = new Label("ID");
             TextField c1 = new TextField(10);
             Panel x2 = new Panel(new FlowLayout(FlowLayout.LEFT));
             Label b2 = new Label("Nombre");
             TextField c2 = new TextField(10);
             Panel x3 = new Panel(new FlowLayout(FlowLayout.LEFT));
             Label b3 = new Label("Hobbies");
             TextArea c3 = new TextArea ();
             Panel x4 = new Panel(new FlowLayout(FlowLayout.LEFT));
             Label b4 = new Label("Grupos");
             Choice c4 = new Choice();
             c4.add("Amigos");
             c4.add("Trabajo");
             p2.add(x1);
                    x1.add(b1);
                    x1.add(c1);
             p2.add(x2);
                    x2.add(b2);
                    x2.add(c2);
             p2.add(x3);
                    x3.add(b3);
                    x3.add(c3);
             p2.add(x4);
                    x4.add(b4);
                    x4.add(c4);}
       Panel damepanel(){
             return p2;}}
package EJERCICIO9;
import java.awt.*;
public class Titulo {
             Panel p1 = new Panel();
             Titulo(){
             Label a1 = new Label ("Ingreso de datos personales");
             p1.add(a1);}
       Panel damepanel(){
             return p1;}}
package EJERCICIO9;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Main {
       public static void main(String[] args) {
             Frame Ventana = new Frame();
             Panel Principal = new Panel(new BorderLayout());
             Ventana.add(Principal);
             Ventana.setVisible(true);
             Ventana.setSize(300,500);
             Titulo p1 = new Titulo();
             Contenido p2 = new Contenido();
             Botones p3 = new Botones();
             Principal.add(p1.damepanel(),BorderLayout.NORTH);
             Principal.add(p2.damepanel(),BorderLayout.CENTER);
             Principal.add(p3.damepanel(),BorderLayout.SOUTH);
             Ventana.setVisible(true);
             Ventana.addWindowListener(new WindowAdapter(){
             public void windowClosing(WindowEvent we){
             System.exit(0);
             }});  
}}
package EJERCICIO10;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Ejercicio10Dialog {
public static void main(String[] args) {
       Frame MiMarco =new Frame();
       Panel MiPanel =new Panel();
       final boolean MODAL=true;
       Dialog Dialogo =new Dialog(MiMarco, "Dialog test", MODAL); 
       MiMarco.add(MiPanel);
       Dialogo.setLocation(40, 75);
       MiMarco.setSize(200,150);
       MiMarco.setTitle("Ejercicio 10 Dialog");
       MiMarco.setVisible(true);
       Dialogo.setVisible(true);
MiMarco.addWindowListener(new WindowAdapter(){
       public void windowClosing(WindowEvent we){
       System.exit(0);
       }});
       }}
package EJERCICIO11FILEDIALOG;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Ejercicio11FileDialog {
public static void main(String[] args) {
             Frame MiMarco = new Frame();
             FileDialog Guardar = new FileDialog (MiMarco,"Guardar mensaje como", FileDialog.SAVE);
             MiMarco.setTitle("Ejercicio 11 FileDialog");
             MiMarco.setSize(500, 500);
             MiMarco.setVisible(true);
             Guardar.setVisible(true);
             MiMarco.addWindowListener(new WindowAdapter(){
                    public void windowClosing(WindowEvent we){
                    System.exit(0);
                    }});
       }}
package EJERCICIO12MENUS;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Ejercicio12parte1 {
       public static void main(String[] args) {
             Frame MiMarco =new Frame();
             Panel MiPanel =new Panel(new GridLayout(2,2));
             MenuBar MenuPrincipal=new MenuBar();
             Menu MPrincipal= new Menu("Menu");
             MenuPrincipal.add(MPrincipal);
             Label Nombrefichero =new Label("Nombre fichero:");
             TextField Vacio1= new TextField();
             Button Ver=new Button("Ver");
             Label Vacio2=new Label();
             MiPanel.add(Nombrefichero);
             MiPanel.add(Vacio1);
             MiPanel.add(Ver);
             MiPanel.add(Vacio2);
             MiMarco.add(MiPanel);
             MiMarco.setMenuBar(MenuPrincipal);
             MiPanel.setBackground(Color.GRAY);
             MiMarco.setVisible(true);
             MiMarco.setSize(400,200);
             MiMarco.addWindowListener(new WindowAdapter(){
                    public void windowClosing(WindowEvent we){
                    System.exit(0);
                    }});
       }}
package EJERCICIO12MENUS;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Ejercicio12parte2 {
       public static void main(String[] args) {
             Frame MiMarco =new Frame();
             Panel MiPanel =new Panel(new GridLayout(2,2));
             MenuBar MenuPrincipal=new MenuBar();
             Menu MenuA= new Menu("Menu A");
             MenuA.add("Primer Elemento del Menu A");
             MenuA.add("Segundo Elemento del Menu A");
             Menu MenuB= new Menu("Menu B");
             MenuB.add("Primer Elemento del Menu B");
             MenuB.add("Segundo Elemento del Menu B");
             MenuB.add("Tercer Elemento del Menu B");
             MenuPrincipal.add(MenuA);
             MenuPrincipal.add(MenuB);
             MiMarco.setMenuBar(MenuPrincipal);
             MiMarco.setTitle("Ventana Menú EJERCICIO12");
             MiMarco.setVisible(true);
             MiMarco.setSize(400,200);
             MiMarco.addWindowListener(new WindowAdapter(){
                    public void windowClosing(WindowEvent we){
                    System.exit(0);
                    }});
       }}