Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/11/2014, 20:51
dayanita_0796
 
Fecha de Ingreso: noviembre-2014
Mensajes: 1
Antigüedad: 9 años, 5 meses
Puntos: 0
Agregar CheckBox

Buenas Noches Quien Me Ayuda Soy Pricipiante 2 Semestre Ing Sistemas Quiero Saber Como Agregar Unos Checkbox Para Estos Botones Como Lo Hag0?
package formulario;
import java.awt.event.*;
import javax.swing.JButton;
import javax.swing.JFrame;
public class Formulario extends JFrame implements ActionListener{
private JButton boton1,boton2,boton3,boton4;
public Formulario() {
setLayout(null);
boton1=new JButton("Tipo De Paquete");
boton1.setBounds(10,100,200,30);
add(boton1);
boton1.addActionListener(this);
boton2=new JButton("Prioridad A");
boton2.setBounds(310,100,200,30);
add(boton2);
boton2.addActionListener(this);
boton3=new JButton("Prioridad B");
boton3.setBounds(550,100,200,30);
add(boton3);
boton3.addActionListener(this);
boton4=new JButton ("Prioridad C");
boton4.setBounds (810,100,200,30);
add (boton4);
boton4.addActionListener(this);

}
public void actionPerformed(ActionEvent e) {
if (e.getSource()==boton1) {
setTitle("boton 1");
}
if (e.getSource()==boton2) {
setTitle("boton 2");
}
if (e.getSource()==boton3) {
setTitle("boton 3");
}
if (e.getSource()==boton4) {
setTitle("boton 4");
}
}
public static void main(String[] ar){
Formulario formulario1=new Formulario();
formulario1.setBounds(0,0,350,200);
formulario1.setVisible(true);
}
}