Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/06/2006, 20:29
zephirot
 
Fecha de Ingreso: junio-2006
Mensajes: 3
Antigüedad: 17 años, 11 meses
Puntos: 0
una preguntilla en awt...

holas.. solo queria hacerles una pregunta....
tengo una interfaz q me agrega cualquier Jtextfield a mi cuadro de choice como otra opcion mas, pero quiero hacer que si agrego un textField que ya existe que no me deje agregar el Jtextfield denuevo...
lo estoy haciendo con un JtextField y el cuadro choice se llama miChoice..
y le di un boton entonces quede aqui...
JButton b1= new JButton("Insertar");
if(lineaTexto.getText()==miChoice.selectAll()){
b1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(ventana, "ya existe.. error se borrara todo",
"information message", JOptionPane.INFORMATION_MESSAGE);
miChoice.removeAll();
}
});}
else {
b1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(ventana, "operacion realizada con exito",
"information message", JOptionPane.INFORMATION_MESSAGE);
miChoice.add(lineaTexto.getText());
}
});
}

mi problema esta en esta linea
if(lineaTexto.getText()==miChoice.selectAll()){
mas bien en la parte de que no se a que igualar el lineaTexto.getText()... se que debo compararlo al choice pero no se como..
si alguien sabe le agradeceria que me respondiera