HI, Can someone help me. In the checkbox below, what I want to achieve is, as a selection is made, (say 120), the value 120 to be part of the drawLine method. Thank you for your time.
[code = java]
import java.applet.*; import java.awt.*; import java.awt.event.*; import java.lang.*;
public class choice extends Applet implements ItemListener{
Choice lang;
String msg="";
public void init(){
lang = new Choice();
lang.add("110");
lang.add("120");
lang.add("130");
lang.add("140");
lang.add("150");
add(lang);
lang.addItemListener(this);
}
public void itemStateChanged (ItemEvent e){
repaint();
}
public void paint(Graphics g){
msg = " ";
msg = msg+lang.getSelectedItem();
g.drawString(msg,100,40);
}
}
[/code]