Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JRadioButton botonPoner = new JRadioButton();
- botonPoner.setActionCommand("poner");
- JRadioButton botonQuitar = new JRadioButton();
- botonQuitar.setActionCommand("quitar");
- JRadioButton botonVerContenido = new JRadioButton();
- botonVerContenido.setActionCommand("ver contenido");
- protected class ManejadorDeEventos implements java.awt.event.ActionListener {
- public void actionPerformed(java.awt.event.ActionEvent evento) {
- switch(evento.getActionCommand()) {
- case "poner" :
- //aqui pones tu implementación que pone
- break;
- case "quitar" :
- //aquí implementas para quitar
- break;
- case "ver contenido":
- //aquí muestras contenido
- break;
- }
- }
- ManejadorDeEventos manejador = new ManejadorDeEVentos();
- botonPoner.addActionListener(manejador);
- botonQuitar.addActionListener(mandejador);
- botonVerContenido.addActionListener(manejador);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement