Está en la página 1de 9

PROGRAMA QUE PERMITE SIMULAR EL

DISEÑO DE UN SISTEMA DE INFROMACION,


MANEJANDO VARIOS FORMULARIOS.
DESDE UN FORMULARIO PRINCIPAL, SE LLAMA A OTROS
FORMULARIOS DONDE SE PUEDEN REALIZAR VARIAS
ACCIIONES.
CLASE PRINCIPAL SISTEMA, FUE CREADO COMO PROYECTO

SU CODIGO ES EL SIGUIENTE.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class SISTEMA extends JFrame{
JLabel L1;
JTextField T1;
JButton B1,B2,B3,B4,B5;
int i=0,sw=0;
public SISTEMA()
{ super("SISTEMA DE INFORMACION");
L1=new JLabel("Ing. Numero");
T1=new JTextField();
B1=new JButton("INGRESAR PERSONA");
B2=new JButton("INGRESAR MATERIAS");
B3=new JButton("INGRESAR FACULTAD");
B4=new JButton("INGRESAR DEPARTAMENTO");
B5=new JButton("SALIR");

add(B1);B1.setBounds(220,100,200,30);
add(B2);B2.setBounds(220,150,200,30);
add(B3);B3.setBounds(220,200,200,30);
add(B4);B4.setBounds(220,250,200,30);
add(B5);B5.setBounds(220,300,200,30);

B1.addActionListener(new ActionListener ()
{
public void actionPerformed (ActionEvent e)
{
PERSONAS li = new PERSONAS();
li.setLayout(null);
li.setSize(700,700);
//li.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //FINALIZAR LA APLICACION
li.setLocationRelativeTo(null);// MUESTRA EL FORMULARIO AL CENTRO DE LA PANTALLA
li.setVisible(true);
}

}
);

B2.addActionListener(new ActionListener ()
{
public void actionPerformed (ActionEvent e)
{
MATERIAS li = new MATERIAS();
li.setLayout(null);
li.setSize(700,700);
// li.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //FINALIZAR LA APLICACION
li.setLocationRelativeTo(null);// MUESTRA EL FORMULARIO AL CENTRO DE LA PANTALLA
li.setVisible(true);

}
}
);

B3.addActionListener(new ActionListener ()
{
public void actionPerformed (ActionEvent e)
{
}
}
);
B4.addActionListener(new ActionListener ()
{
public void actionPerformed (ActionEvent e)
{
}
}
);
B5.addActionListener(new ActionListener ()
{
public void actionPerformed (ActionEvent e)
{
JOptionPane.showMessageDialog(null,"FIN DEL SISTEMA");
System.exit(0);
}
}
);
}

public static void main(String[] args) {


SISTEMA li = new SISTEMA();
li.setLayout(null);
li.setSize(700,700);
li.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //FINALIZAR LA APLICACION
li.setLocationRelativeTo(null);// MUESTRA EL FORMULARIO AL CENTRO DE LA PANTALLA
li.setVisible(true);
}
}

CLASE PERSONAS
SU PANTALLA ES EL SIGUIENTE.
//SU CODIGO
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class PERSONAS extends JFrame{
JLabel L1,L2,L3,L4;
JTextField T1,T2,T3;
JButton B1,B2,B3,B4,B5;
int i=0,sw=0;
public PERSONAS()
{ super("MANEJO LISTAS");
L1=new JLabel("Ing. Nombre");
L2=new JLabel("Ing. Doreccion");
L3=new JLabel("Ing. Celular");
L4=new JLabel("DATOS DE PERSONAS");
T1=new JTextField();
T2=new JTextField();
T3=new JTextField();
B1=new JButton("GRABAR");
B2=new JButton("REPORTES");

add(L4);L4.setBounds(200,40,200,30);

add(L1);L1.setBounds(80,100,100,30);
add(T1);T1.setBounds(190,100,200,30);

add(L2);L2.setBounds(80,200,100,30);
add(T2);T2.setBounds(190,200,200,30);

add(L3);L3.setBounds(80,300,100,30);
add(T3);T3.setBounds(190,300,200,30);
add(B1);B1.setBounds(100,400,180,30);
add(B2);B2.setBounds(320,400,200,30);

B1.addActionListener(new ActionListener ()
{
public void actionPerformed (ActionEvent e)
{
sw=1;
repaint();
}
}
);

B2.addActionListener(new ActionListener ()
{
public void actionPerformed (ActionEvent e)
{

}
}
);
}

public void paint(Graphics g)


{ int i=0;
//g.clearRect(0,79,550,700);
super.paint(g);
if (sw==1)
{ Font fuente=new Font("Algerian", Font.BOLD,20);
g.setFont(fuente);
g.setColor(Color.blue);
g.drawString("VEC_ORIGINAL",50,100);
for (i=0;i<=700;i+=5)
{
g.drawLine(0,0,i,600);
}
}

//CLASE MATERIAS SU PANTALLA ES EL SIGUIENTE

// SU CODIGO ES EL SIGUIENTE
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class MATERIAS extends JFrame{
JLabel L1,L2,L3,L4;
JTextField T1,T2,T3;
JButton B1,B2,B3,B4,B5;
int i=0,sw=0;
public MATERIAS()
{ super("MANEJO LISTAS");
L1=new JLabel("Ing. Materia");
L2=new JLabel("Ing. Sigla");
L3=new JLabel("Ing. Carrera");
L4=new JLabel("DATOS DE MATERIAS");
T1=new JTextField();
T2=new JTextField();
T3=new JTextField();
B1=new JButton("GRABAR");
B2=new JButton("ELIMINAR");

add(L4);L4.setBounds(200,40,200,30);

add(L1);L1.setBounds(80,100,150,30);
add(T1);T1.setBounds(190,100,100,30);

add(L2);L2.setBounds(80,200,100,30);
add(T2);T2.setBounds(190,200,200,30);

add(L3);L3.setBounds(80,300,100,30);
add(T3);T3.setBounds(190,300,200,30);
add(B1);B1.setBounds(190,400,180,30);
add(B2);B2.setBounds(420,400,200,30);

B1.addActionListener(new ActionListener ()
{
public void actionPerformed (ActionEvent e)
{
sw=1;
repaint();
}
}
);

B2.addActionListener(new ActionListener ()
{
public void actionPerformed (ActionEvent e)
{

}
}
);
}
public void paint(Graphics g)
{ int i=0;
//g.clearRect(0,79,550,700);
super.paint(g);
if (sw==1)
{ Font fuente=new Font("Algerian", Font.BOLD,20);
g.setFont(fuente);
g.setColor(Color.blue);
g.drawString("VEC_ORIGINAL",50,100);
for (i=0;i<=700;i+=5)
{
g.drawRect(10+i,10+i,50+i,50+i);
}
}

}
}

También podría gustarte