Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.WindowAdapter;
- import java.awt.event.WindowEvent;
- import javax.swing.JButton;
- import javax.swing.JDialog;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JTextField;
- import javax.swing.WindowConstants;
- import java.awt.Dimension;
- public class jframecb {
- private JFrame ventanaPrincipal;
- private JDialog ventanaCrear;
- private JDialog ventanaIngresar;
- private JDialog ventanaSacar;
- private JDialog ventanaActualizar;
- /**
- * @param args
- */
- public static void main(String[] args) {
- new jframecb();
- }
- public jframecb()
- {
- // Construcción de ventana principal
- ventanaPrincipal = new JFrame("Ventana principal");
- ventanaPrincipal.setMinimumSize(new Dimension(800, 600));
- ventanaPrincipal.setAutoRequestFocus(false);
- ventanaPrincipal.setResizable(false);
- JButton boton1 = new JButton("Crear Cuenta");
- boton1.setBounds(156, 116, 483, 23);
- JButton boton2 = new JButton("Ingresar Dinero");
- boton2.setBounds(156, 315, 483, 23);
- JButton boton3 = new JButton("Sacar Dinero");
- boton3.setBounds(156, 349, 483, 23);
- JButton boton4 = new JButton("Actualizar Saldo");
- boton4.setBounds(156, 383, 483, 23);
- ventanaPrincipal.getContentPane().setLayout(null);
- ventanaPrincipal.getContentPane().add(boton1);
- ventanaPrincipal.getContentPane().add(boton2);
- ventanaPrincipal.getContentPane().add(boton3);
- ventanaPrincipal.getContentPane().add(boton4);
- ventanaPrincipal.pack();
- // Construcción de ventana para Crear Cuenta
- ventanaCrear = new JDialog(ventanaPrincipal,"Crear Cuenta");
- ventanaCrear.setMinimumSize(new Dimension(800, 600));
- ventanaCrear.getContentPane().setLayout(null);
- JTextField textField = new JTextField();
- textField.setBounds(340, 43, 280, 20);
- ventanaCrear.getContentPane().add(textField);
- textField.setColumns(10);
- JTextField textField_1 = new JTextField();
- textField_1.setBounds(340, 74, 280, 20);
- ventanaCrear.getContentPane().add(textField_1);
- textField_1.setColumns(10);
- JTextField textField_2 = new JTextField();
- textField_2.setBounds(340, 105, 280, 20);
- ventanaCrear.getContentPane().add(textField_2);
- textField_2.setColumns(10);
- JTextField textField_3 = new JTextField();
- textField_3.setBounds(340, 136, 280, 20);
- ventanaCrear.getContentPane().add(textField_3);
- textField_3.setColumns(10);
- JTextField textField_4 = new JTextField();
- textField_4.setEditable(false);
- textField_4.setBounds(340, 167, 280, 20);
- ventanaCrear.getContentPane().add(textField_4);
- textField_4.setColumns(10);
- JTextField textField_5 = new JTextField();
- textField_5.setBounds(340, 198, 280, 20);
- ventanaCrear.getContentPane().add(textField_5);
- textField_5.setColumns(10);
- JTextField textField_6 = new JTextField();
- textField_6.setBounds(340, 229, 280, 20);
- ventanaCrear.getContentPane().add(textField_6);
- textField_6.setColumns(10);
- JButton btnCrearCuenta = new JButton("Crear Cuenta");
- btnCrearCuenta.setBounds(340, 319, 280, 20);
- ventanaCrear.getContentPane().add(btnCrearCuenta);
- JLabel lblNombreDelTitular = new JLabel("Nombre del titular");
- lblNombreDelTitular.setBounds(130, 46, 200, 14);
- ventanaCrear.getContentPane().add(lblNombreDelTitular);
- JLabel lblApellidos = new JLabel("Apellidos");
- lblApellidos.setBounds(130, 77, 200, 14);
- ventanaCrear.getContentPane().add(lblApellidos);
- JLabel lblDni = new JLabel("DNI");
- lblDni.setBounds(130, 108, 200, 14);
- ventanaCrear.getContentPane().add(lblDni);
- JLabel lblTelefono = new JLabel("Telefono");
- lblTelefono.setBounds(130, 139, 200, 14);
- ventanaCrear.getContentPane().add(lblTelefono);
- JLabel lblNumeroDeCuenta = new JLabel("Numero de cuenta");
- lblNumeroDeCuenta.setBounds(130, 170, 200, 14);
- ventanaCrear.getContentPane().add(lblNumeroDeCuenta);
- JLabel lblCantidadDeDinero = new JLabel("Cantidad de dinero");
- lblCantidadDeDinero.setBounds(130, 201, 200, 14);
- ventanaCrear.getContentPane().add(lblCantidadDeDinero);
- JLabel lblIntersAnual = new JLabel("Inter\u00E9s anual");
- lblIntersAnual.setBounds(130, 232, 200, 14);
- ventanaCrear.getContentPane().add(lblIntersAnual);
- // Constructor de ventana para Ingresar Dinero
- ventanaIngresar = new JDialog(ventanaPrincipal, "Ingresar Dinero");
- ventanaIngresar.setMinimumSize(new Dimension(800, 600));
- ventanaIngresar.getContentPane().setLayout(null);
- JTextField textFieldid = new JTextField();
- textFieldid.setBounds(156, 187, 177, 20);
- ventanaIngresar.getContentPane().add(textFieldid);
- textFieldid.setColumns(10);
- JTextField textField_1id = new JTextField();
- textField_1id.setBounds(156, 233, 177, 20);
- ventanaIngresar.getContentPane().add(textField_1id);
- textField_1id.setColumns(10);
- JLabel lblNumeroDeCuentaid = new JLabel("Numero de cuenta");
- lblNumeroDeCuentaid.setBounds(47, 190, 99, 14);
- ventanaIngresar.getContentPane().add(lblNumeroDeCuentaid);
- JLabel lblCantidadAIngresarid = new JLabel("Cantidad a ingresar");
- lblCantidadAIngresarid.setBounds(47, 236, 99, 14);
- ventanaIngresar.getContentPane().add(lblCantidadAIngresarid);
- JButton btnIngresarid = new JButton("Ingresar");
- btnIngresarid.setBounds(344, 208, 89, 23);
- ventanaIngresar.getContentPane().add(btnIngresarid);
- JTextField textField_2id = new JTextField();
- textField_2id.setEditable(false);
- textField_2id.setBounds(482, 209, 170, 20);
- ventanaIngresar.getContentPane().add(textField_2id);
- textField_2id.setColumns(10);
- JLabel SaldoActual = new JLabel("Saldo actual");
- SaldoActual.setBounds(531, 166, 89, 14);
- ventanaIngresar.getContentPane().add(SaldoActual);
- // Constructor de ventana para Sacar Dinero
- ventanaSacar = new JDialog(ventanaPrincipal, "Sacar Dinero");
- ventanaSacar.setMinimumSize(new Dimension(800, 600));
- ventanaSacar.getContentPane().setLayout(null);
- JLabel lblNumeroDeCuentasd = new JLabel("Numero de cuenta");
- lblNumeroDeCuentasd.setBounds(47, 190, 99, 14);
- ventanaSacar.getContentPane().add(lblNumeroDeCuentasd);
- JLabel lblCantidadARetirarsd = new JLabel("Cantidad a retirar");
- lblCantidadARetirarsd.setBounds(47, 236, 99, 14);
- ventanaSacar.getContentPane().add(lblCantidadARetirarsd);
- JTextField textFieldsd = new JTextField();
- textFieldsd.setBounds(156, 187, 177, 20);
- ventanaSacar.getContentPane().add(textFieldsd);
- textFieldsd.setColumns(10);
- JTextField textField_1sd = new JTextField();
- textField_1sd.setBounds(156, 233, 177, 20);
- ventanaSacar.getContentPane().add(textField_1sd);
- textField_1sd.setColumns(10);
- JButton btnRetirarsd = new JButton("Retirar");
- btnRetirarsd.setBounds(344, 208, 89, 23);
- ventanaSacar.getContentPane().add(btnRetirarsd);
- JTextField textField_2sd = new JTextField();
- textField_2sd.setEditable(false);
- textField_2sd.setBounds(482, 209, 170, 20);
- ventanaSacar.getContentPane().add(textField_2sd);
- textField_2sd.setColumns(10);
- JLabel SaldoActualsd = new JLabel("Saldo actual");
- SaldoActualsd.setBounds(531, 166, 89, 14);
- ventanaSacar.getContentPane().add(SaldoActualsd);
- // Constructor de ventana para Actualizar Saldo
- ventanaActualizar = new JDialog(ventanaPrincipal, "Actualizar Saldo");
- ventanaActualizar.setMinimumSize(new Dimension(800, 600));
- ventanaActualizar.getContentPane().setLayout(null);
- JLabel lblNumeroDeCuentaas = new JLabel("N\u00FAmero de cuenta");
- lblNumeroDeCuentaas.setBounds(94, 135, 110, 14);
- ventanaActualizar.getContentPane().add(lblNumeroDeCuentaas);
- JTextField textFieldas = new JTextField();
- textFieldas.setBounds(94, 188, 169, 20);
- ventanaActualizar.getContentPane().add(textFieldas);
- textFieldas.setColumns(10);
- JButton btnAplicarInteresas = new JButton("Aplicar Interes");
- btnAplicarInteresas.setBounds(325, 155, 110, 23);
- ventanaActualizar.getContentPane().add(btnAplicarInteresas);
- JLabel lblSaldoActualizadoas = new JLabel("Saldo actualizado");
- lblSaldoActualizadoas.setBounds(491, 135, 102, 14);
- ventanaActualizar.getContentPane().add(lblSaldoActualizadoas);
- JTextField textField_1as = new JTextField();
- textField_1as.setEditable(false);
- textField_1as.setBounds(491, 188, 169, 20);
- ventanaActualizar.getContentPane().add(textField_1as);
- textField_1as.setColumns(10);
- // ABRIR SECUNDARIAS Y CERRAR PRINCIPAL
- boton1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- ventanaPrincipal.setVisible(false);
- ventanaCrear.setVisible(true);
- }
- });
- boton2.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- ventanaPrincipal.setVisible(false);
- ventanaIngresar.setVisible(true);
- }
- });
- boton3.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- ventanaPrincipal.setVisible(false);
- ventanaSacar.setVisible(true);
- }
- });
- boton4.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- ventanaPrincipal.setVisible(false);
- ventanaActualizar.setVisible(true);
- }
- });
- // CERRAR SECUNDARIAS Y ABRIR PRIMARIA
- ventanaCrear.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- ventanaPrincipal.setVisible(true);
- ventanaCrear.setVisible(false);
- }
- public void windowClosed(WindowEvent e) {
- ventanaPrincipal.setVisible(true);
- ventanaCrear.setVisible(false);
- }
- });
- ventanaIngresar.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- ventanaPrincipal.setVisible(true);
- ventanaIngresar.setVisible(false);
- }
- public void windowClosed(WindowEvent e) {
- ventanaPrincipal.setVisible(true);
- ventanaIngresar.setVisible(false);
- }
- });
- ventanaSacar.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- ventanaPrincipal.setVisible(true);
- ventanaSacar.setVisible(false);
- }
- public void windowClosed(WindowEvent e) {
- ventanaPrincipal.setVisible(true);
- ventanaSacar.setVisible(false);
- }
- });
- ventanaActualizar.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- ventanaPrincipal.setVisible(true);
- ventanaActualizar.setVisible(false);
- }
- public void windowClosed(WindowEvent e) {
- ventanaPrincipal.setVisible(true);
- ventanaActualizar.setVisible(false);
- }
- });
- // Mostrar la ventana principal
- ventanaPrincipal.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
- ventanaPrincipal.setVisible(true);
- }
- }
Add Comment
Please, Sign In to add comment