Hobbies
Enviado por will gerhard tenorio quispe • 2 de Noviembre de 2018 • Práctica o problema • 1.586 Palabras (7 Páginas) • 122 Visitas
import java.awt.GridLayout;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.*;
public class Hobbies extends JFrame implements ItemListener{
JCheckBox b1,b2,b3,b4,b5,b6,b7;
JTextArea t1;
public void init() {
JPanel pSuper= new JPanel();
JPanel panel1= new JPanel();
JPanel panel2= new JPanel();
JPanel panel3= new JPanel();
b1=new JCheckBox("Música");
b1.addItemListener(this);
b2=new JCheckBox("Deporte");
b2.addItemListener(this);
b3=new JCheckBox("Aventura");
b3.addItemListener(this);
b4=new JCheckBox("Teror");
b4.addItemListener(this);
b5=new JCheckBox("Accion");
b5.addItemListener(this);
b6=new JCheckBox("Comedia");
b6.addItemListener(this);
b7=new JCheckBox("Romantica");
b7.addItemListener(this);
t1=new JTextArea(" ");
t1.setLineWrap(true);
t1.setRows(5);
t1.setColumns(25);
panel1.setLayout(new GridLayout(3,1));
panel1.setBorder(BorderFactory.createTitledBorder("Pasa tiempos"));
panel1.add(b1);
panel1.add(b2);
panel1.add(b3);
panel3.setLayout(new GridLayout(1,4));
panel3.setBorder(BorderFactory.createTitledBorder("Peliculas Favoritas"));
panel3.add(b4);
panel3.add(b5);
panel3.add(b6);
panel3.add(b7);
panel2.setBorder(BorderFactory.createTitledBorder("Resultados"));
panel2.add(t1);
//b1.addItemListener(this);
setTitle("Hobbies");
...