Java Reference
In-Depth Information
boolean result = false;
Vector fieldList = new Vector();
class FieldInfo {
int id;
int type;
TextField field;
}
class FieldPane extends Panel {
Panel labels = new Panel(new GridLayout(0, 1));
Panel fields = new Panel(new GridLayout(0, 1));
int type;
FieldPane(int type) {
super(new BorderLayout());
this.type = type;
add(labels, BorderLayout.WEST);
add(fields, BorderLayout.CENTER);
}
void addField(int id, int type) {
FieldInfo info = new FieldInfo();
info.id = id;
info.field = new TextField(30);
info.type = type;
labels.add(new Label(contactList.getFieldLabel(id)));
fields.add(info.field);
fieldList.addElement(info);
}
}
public void actionPerformed(ActionEvent ev) {
result = ev.getSource() == okButton;
hide();
}
void addSub(int id, String type, int typeId) {
FieldPane fieldPane = (FieldPane) cards.get(type);
if (fieldPane == null) {
fieldPane = new FieldPane(typeId);
typeChoice.add(type);
cards.put(type, fieldPane);
Panel compact = new Panel(new BorderLayout());
compact.add(fieldPane, BorderLayout.NORTH);
ScrollPane sp = new ScrollPane();
sp.add(compact);
cardPane.add(sp, type);
}
fieldPane.addField(id, typeId);
}
void addField(int id) {
if (id == Contact.UID || id == Contact.REVISION)
return;
int dataType = contact.getDataType(id);
if (dataType == PIMElement.STRING)
addSub(id, "Main", -1);
else if (dataType == PIMElement.STRING_TYPED) {
int[] types = contactList.getSupportedTypes(id);
for (int i = 0; i < types.length; i++) {
Search WWH ::




Custom Search