F
Franz
Hi,
I wrote a little Midlet and want to have a StringItem and a TextField
next to each other, i.e. they should be in the same row. After
considering MID Profile I coded my Midlet as listed below.
So in my understanding they should be in the same row. The only
condition, which I cannot be sure of is "this Item has a LAYOUT_LEFT,
LAYOUT_CENTER, or LAYOUT_RIGHT directive that differs from the Form's
current alignment." (MIDP, class Form).
But how can I set the directive of a Form? Or did I misunderstand sth?
Why are the two items not in ONE row?
Thanks in advance!
Best regards, Franz
---BEGIN CODE---
public class Layout extends MIDlet implements CommandListener {
private Display display;
private Form form;
private Command EXIT;
public Layout() {
display = Display.getDisplay(this);
}
public void startApp() {
form = new Form("LayoutTest");
EXIT = new Command("Exit", Command.SCREEN, 1);
StringItem s1 = new StringItem("", "Eingabe:");
TextField tf1 = new TextField("", "", 20, TextField.ANY);
tf1.setLayout(TextField.LAYOUT_2);
form.append(s1);
form.append(tf1);
form.addCommand(EXIT);
form.setCommandListener(this);
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command command, Displayable
displayable) {
if(command == EXIT) {
destroyApp(false);
notifyDestroyed();
}
}
}
---END CODE---
I wrote a little Midlet and want to have a StringItem and a TextField
next to each other, i.e. they should be in the same row. After
considering MID Profile I coded my Midlet as listed below.
So in my understanding they should be in the same row. The only
condition, which I cannot be sure of is "this Item has a LAYOUT_LEFT,
LAYOUT_CENTER, or LAYOUT_RIGHT directive that differs from the Form's
current alignment." (MIDP, class Form).
But how can I set the directive of a Form? Or did I misunderstand sth?
Why are the two items not in ONE row?
Thanks in advance!
Best regards, Franz
---BEGIN CODE---
public class Layout extends MIDlet implements CommandListener {
private Display display;
private Form form;
private Command EXIT;
public Layout() {
display = Display.getDisplay(this);
}
public void startApp() {
form = new Form("LayoutTest");
EXIT = new Command("Exit", Command.SCREEN, 1);
StringItem s1 = new StringItem("", "Eingabe:");
TextField tf1 = new TextField("", "", 20, TextField.ANY);
tf1.setLayout(TextField.LAYOUT_2);
form.append(s1);
form.append(tf1);
form.addCommand(EXIT);
form.setCommandListener(this);
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command command, Displayable
displayable) {
if(command == EXIT) {
destroyApp(false);
notifyDestroyed();
}
}
}
---END CODE---