I built a user interface within awt which contains several lists. Each
list has got different options. The user can click on one of these options
and the text populates a textarea. There is a different textarea per list.
So far so good. However, I wanted the user to be able to enter more text
in the textarea if he/she wishes to do so, or alter the current one. This
is not feasible and I don't see why at all.
I made a simpler applet to test this issue, and I get the same bug. I
attach the code. Any ideas please?
ListExample.java
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class ListExample extends Applet {
TextField listStatus, extra;
List scrollingList;
public void init() {
scrollingList = new List(3,true);
scrollingList.add("swkrates");
scrollingList.add("plato");
scrollingList.add("aristotelis");
scrollingList.select(2);
add(scrollingList);
listStatus=new TextField ("you selected plato");
extra = new TextField("where's this?");
add(listStatus);
add(extra);
boolean print=listStatus.isEditable();
System.out.println("can I edit it? " + print);
}
public boolean handleEvent(Event evt) {
String selectionString;
Integer selection;
if(evt.target== scrollingList) {
if(evt.id==Event.LIST_SELECT){
selection=(Integer) evt.arg;
selectionString="You selected entry " +
scrollingList.getItem(selection.intValue());
listStatus.setText(selectionString);
boolean why=listStatus.isEditable();
System.out.println("editable in here? " + why);
}
else if (evt.id == Event.LIST_DESELECT) {
selection=(Integer) evt.arg;
selectionString="you deselected entry " +
scrollingList.getItem(selection.intValue());
listStatus.setText(selectionString);
boolean why2=listStatus.isEditable();
System.out.println("deselect editable " + why2);
}
}
return true;
****************************Quote:}
}
ListExample.html
<html>
<head>
<title>Good layout!</title>
</head>
<applet code="ListExample.class" height=400 width=600>
You need a java-enabled browser to see this.
</applet>
</body>
</html>