package userclasses;
import com.codename1.io.Log;
import com.codename1.ui.Button;
import com.codename1.ui.Container;
import com.codename1.ui.Form;
import com.codename1.ui.Label;
import com.codename1.ui.TextArea;
import com.codename1.ui.events.ActionEvent;
import com.codename1.ui.events.ActionListener;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.layouts.BoxLayout;
public class MyApp {
private int numb = 0;
public MyApp() {
}
public void start() {
Log.p("start in Myapp");
Form main = new Form("Test of TextArea");
TextArea firstArea = new TextArea(3, 20);
TextArea secondArea = new TextArea(3, 20);
final Label label = new Label("Some text");
Button actionButton = new Button("The action starts here");
actionButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
numb++;
label.setText("Pressed: " + numb);
}
});
main.setLayout(new BorderLayout());
Container center = new Container(new BoxLayout(BoxLayout.Y_AXIS));
center.addComponent(firstArea);
center.addComponent(secondArea);
center.addComponent(label);
center.addComponent(actionButton);
main.addComponent(BorderLayout.CENTER, center);
main.show();
}
}