|
|
.Sobre mí |
Jorge Cabrera
My Hobbie es practicar deporte // mi gusto es salir a pasear //
»
Ver perfil
|
|
|
.Calendario |
|
Mayo 2024 |
|
|
DO | LU | MA | MI | JU | VI | SA | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.applet.*;
public class Frmciudad extends JFrame
{
private JPanel mpanel=new JPanel();
private JPanel panelDatos=new JPanel();
private JButton boton=new JButton("Cancelar",new ImageIcon("close-panel.png"));
private JButton boton5=new JButton("Aceptar",new ImageIcon("save.png"));
private JButton boton6=new JButton("...");
private JButton boton2=new JButton("Nuevo",new ImageIcon("run.png"));
private JButton boton3=new JButton("Modificar",new ImageIcon("preview.png"));
private JButton boton4=new JButton("Eliminar",new ImageIcon("reset_option.png"));
private JTextField text=new JTextField();// para texto
private JLabel texto=new JLabel("Codigo");// para crear un mensajes
private JTextField text1=new JTextField();
private JLabel texto1=new JLabel("Descripción");
Frmciudad()
{
this.setSize(500,400);//tamaño de la ventana
this.setLocation(300,200);
this.setTitle("BIENVENIDOS");
this.addWindowListener(
new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
this.setContentPane(Contenedor());
}
private JPanel Contenedor()
{
mpanel.setLayout(null);//indicar a la pantalla donde se va a ubicar los botones
mpanel.setBackground(new Color(148,219,4));
texto.setBounds(160,60,150,20);
texto.setFont(new Font("Comic Sans MS",1,14));
mpanel.add(texto);
text.setBounds(240,60,150,20);
text.setEnabled(false);
mpanel.add(text);
boton6.setBounds(400,60,30,20);
boton6.setEnabled(false);
mpanel.add(boton6);
texto1.setBounds(160,90,150,20);
texto1.setFont(new Font("Comic Sans MS",1,14));
mpanel.add(texto1);
text1.setBounds(240,90,150,20);
text1.setEnabled(false);
mpanel.add(text1);
boton.setBounds(200,200,108,20);
boton.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
Botcancelar_click();
}
}
);
boton.setEnabled(false);
mpanel.add(boton);
boton5.setBounds(380,200,108,20);
boton5.setEnabled(false);
mpanel.add(boton5);
boton2.setBounds(30,70,108,20);
boton2.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
Botnuevo_click();
}
}
);
mpanel.add(boton2);
boton3.setBounds(30,110,108,20);
boton3.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
Botmodificar_click();
}
}
);
mpanel.add(boton3);
boton4.setBounds(30,150,108,20);
boton4.setEnabled(false);
mpanel.add(boton4);
panelDatos.setBounds(140,40,400,150);
panelDatos.setBorder(BorderFactory.createEtchedBorder());
panelDatos.setOpaque(false);
panelDatos.setLayout(null);
mpanel.add(panelDatos);
return mpanel;
}
private void Botnuevo_click()
{
boton2.setNextFocusableComponent(text);
boton2.nextFocus();
text.setEnabled(true);
text1.setEnabled(true);
boton6.setEnabled(true);
boton.setEnabled(true);
boton5.setEnabled(true);
boton2.setEnabled(false);
boton3.setEnabled(false);
boton4.setEnabled(false);
}
private void Botcancelar_click()
{
text.setEnabled(false);
text1.setEnabled(false);
boton2.setEnabled(true);
boton6.setEnabled(false);
boton.setEnabled(false);
boton5.setEnabled(false);
boton3.setEnabled(true);
boton4.setEnabled(true);
Borrar_cajas();
}
private void Botmodificar_click()
{
boton3.setNextFocusableComponent(text1);
boton3.nextFocus();
text.setEnabled(false);
text1.setEnabled(true);
boton6.setEnabled(true);
boton.setEnabled(true);
boton5.setEnabled(false);
boton3.setEnabled(false);
boton4.setEnabled(false);
boton2.setEnabled(false);
}
private void Borrar_cajas()
{
text.setText("");
text1.setText("");
}
} |
|