Java. What to do with Choice()???
- by modzo
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class ChoiceSample extends Applet
implements ActionListener, ItemListener {
Choice dz2;
public void init(){
dz2 = new Choice();
dz2.addItem("female");
dz2.addItem("male");
dz2.addItemListener(this);
add(dz2);
public void itemStateChanged(ItemEvent e) {
String result = dz2.getSelectedItem();
repaint();
if(result.equals(getParameter("male"))){
dz1 = 0.5;
}
else{
dz1 = 0.7;
}
}
}
/*
this is yust a fragment from my program but this is the only
thing that I can`t make right.
I need when I chose male - dz1 = 0.5, but when I chose female dz1 = 0.7
Can someone help me, please?
*/