paramString()不行,点all输出的是n1的内容,而且内容很长.
import java.net.*;
import java.awt.event.*;
import java.awt.*;
import java.sql.*;
public class Test implements FocusListener{
public void dd() {
CheckboxGroup nlst = new CheckboxGroup();
Checkbox all = new Checkbox("所有人", nlst, false);
Checkbox n1 = new Checkbox("测试", nlst, false);
all.addFocusListener(this);
n1.addFocusListener(this);
Label lab=new Label("");
lab.setBackground(Color.lightGray);
System.out.print(all.getLabel());
Panel p=new Panel();
Frame f=new Frame("hi");
f.setSize(300,300);
p.add(all);
p.add(n1);
p.add(lab);
f.add(p);
f.setVisible(true);
}
public static void main(String[] args) {
Test t = new Test();
t.dd();
}
public void focusGained(FocusEvent e) {
System.out.println(e.paramString());
}
public void focusLost(FocusEvent e) {
}
}