Eclipse - problemas con ActionListener

 
Vista:

problemas con ActionListener

Publicado por 2222 (1 intervención) el 22/11/2016 21:19:24
Hola,soy un poco nuevo en eclipse y estoy intentando que al momento de seleccionar alguno de los grupo de botones los demás de esté grupo se coloquen en disabled con un ActionListener más me marca error en el titulo del programa ('Election') al agregar "implements ActionListener"...aquí esta el programa:

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/***:
*Programa: Elecciones.java
*Autor:    2222
*Fecha:    22/11/16
*Descripcion: Practica de multiples comandos
***/
 
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
 
public class Election extends JFrame implements ActionListener {
 
    private JLabel eb,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10;
    private JTextField fut;
    private JButton bc;
    private JCheckBox r1,r2,r3,r4,r5,r6;
    private JComboBox cand,pais;
    private JPanel panel1;
    private JRadioButton prs1,prs2,prs3,prs4,prs5,prs6,prs7,prs8,prs9,prs10,prs11,prs12,a1,a2,a3,a4;
    private JFrame marco;
    private JTextArea com;
    private ButtonGroup grupo1;
 
   public static void main(String[] args){
   Election enc = new Election();
   enc.setSize(1080,500);
   enc.encGUI();
   enc.setVisible(true);
   }
   public void encGUI () {
   setDefaultCloseOperation(EXIT_ON_CLOSE);
   Container ventana = getContentPane();
      ventana.setLayout(null);
 
    eb = new JLabel();
    eb.setBounds(400,0, 300, 20 );
    eb.setText("Favor de Responder las siguientes preguntas");
    ventana.add(eb);
 
    p1 = new JLabel ();
    p1.setBounds(1, 30, 300, 30);
    p1.setText("Usted voto por:");
    ventana.add(p1);
 
    cand = new JComboBox();
    cand.setBounds(90, 30, 90, 30);
    cand.addItem("Hillary");
    cand.addItem("Trump");
    cand.addItem("G. Johnsom");
    cand.addItem("J. Stein");
    cand.addItem("Otro");
    cand.setVisible(true);
    ventana.add(cand);
 
    p2 = new JLabel();
    p2.setBounds(1, 70, 300, 30);
    p2.setText("Esté candidato le dio:");
    ventana.add (p2);
 
    ButtonGroup grupo1 = new ButtonGroup();
 
    prs1 = new JRadioButton ("Confianza");
    prs1.setBounds(1, 90, 100, 30);
    ventana.add(prs1);
 
    prs2 = new JRadioButton ("Credibilidad");
    prs2.setBounds(1, 120, 100, 30);
    ventana.add(prs2);
 
    prs3 = new JRadioButton ("Promesa de cambio");
    prs3.setBounds(120, 90, 200, 30);
    ventana.add(prs3);
 
    prs4 = new JRadioButton ("Ninguna de las anteriores");
    prs4.setBounds(120, 120, 200, 30);
    ventana.add(prs4);
 
    p3 = new JLabel ("Esta conforme con el presidente electo");
    p3.setBounds(1, 145, 300, 30);
    ventana.add(p3);
 
    r1 = new JCheckBox ("Si");
    r1.setBounds(1, 170, 200, 30);
    ventana.add(r1);
 
    r2 = new JCheckBox ("No");
    r2.setBounds(220, 170, 200, 30);
    ventana.add(r2);
 
    p4 = new JLabel("¿A qué se debe esta respuesta?");
    p4.setBounds(1, 200, 280 ,30);
    ventana.add(p4);
 
    com = new JTextArea();
    com.setSize(40,40);
    com.setBounds(1, 220, 290, 150);
    com.setLineWrap(true);
    ventana.add(com);
 
    p5 = new JLabel("¿Comó ve a Estados Unidos dentro de 4 años?");
    p5.setBounds(1, 365, 280 ,30);
    ventana.add(p5);
 
    prs5 = new JRadioButton ("Con mejor economia");
    prs5.setBounds(1, 390, 175, 30);
    ventana.add(prs5);
 
    prs6 = new JRadioButton ("En guerra");
    prs6.setBounds(1, 415, 100, 30);
    ventana.add(prs6);
 
    prs7 = new JRadioButton ("Cooperando con otreos paises");
    prs7.setBounds(180, 390, 200, 30);
    ventana.add(prs7);
 
    prs8 = new JRadioButton ("Dividida");
    prs8.setBounds(180, 415, 200, 30);
    ventana.add(prs8);
 
    p6 = new JLabel("¿Comó ve al mundo dentro de 4 años?");
    p6.setBounds(500, 40, 280 ,30);
    ventana.add(p6);
 
    prs9 = new JRadioButton ("Independiente a E.U.");
    prs9.setBounds(500, 65, 175, 30);
    ventana.add(prs9);
 
    prs10 = new JRadioButton ("En guerra");
    prs10.setBounds(500, 95, 100, 30);
    ventana.add(prs10);
 
    prs11 = new JRadioButton ("Dependiente de E.U.");
    prs11.setBounds(680, 65, 200, 30);
    ventana.add(prs11);
 
    prs12 = new JRadioButton ("Igual");
    prs12.setBounds(680, 95, 200, 30);
    ventana.add(prs12);
 
    p7 = new JLabel ();
    p7.setBounds(500, 120, 300, 30);
    p7.setText("Usted cambiaria su voto:");
    ventana.add(p7);
 
    r3 = new JCheckBox ("Si");
    r3.setBounds(500, 150, 100, 30);
    ventana.add(r3);
 
    r4 = new JCheckBox ("No");
    r4.setBounds(680, 150, 100, 30);
    ventana.add(r4);
 
    p8 = new JLabel ();
    p8.setBounds(500, 180, 400, 30);
    p8.setText("¿Cree usted que la persona por quien voto cambiaria las cosas?");
    ventana.add(p8);
 
    a1 = new JRadioButton ("Seguramente");
    a1.setBounds(500, 210, 150, 30);
    ventana.add(a1);
 
    a2 = new JRadioButton ("Quizá");
    a2.setBounds(500, 240, 100, 30);
    ventana.add(a2);
 
    a3 = new JRadioButton ("Poco probable");
    a3.setBounds(680, 210, 200, 30);
    ventana.add(a3);
 
    a4 = new JRadioButton ("Para nada");
    a4.setBounds(680, 240, 200, 30);
    ventana.add(a4);
 
    p9 = new JLabel ();
    p9.setBounds(500, 270, 300, 30);
    p9.setText("¿Tiene planeado emigrar?");
    ventana.add(p9);
 
    r5 = new JCheckBox ("Si");
    r5.setBounds(500, 300, 100, 30);
    ventana.add(r5);
 
    r6 = new JCheckBox ("No");
    r6.setBounds(680, 300, 100, 30);
    ventana.add(r6);
 
    p10 = new JLabel ();
    p10.setBounds(500, 330, 300, 30);
    p10.setText("¿Qué pais le agrada mas?");
    ventana.add(p10);
 
    pais = new JComboBox();
    pais.setBounds(680, 330, 90, 30);
    pais.addItem("Canada");
    pais.addItem("Rusia");
    pais.addItem("Alemania");
    pais.addItem("Noruega");
    pais.addItem("Otro");
    pais.setVisible(true);
    ventana.add(pais);
 
    bc = new JButton ("Enviar");
    bc.setBounds(700, 400, 90, 30);
    ventana.add(bc);
 
   }
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder