mainForm = new Form();
mainForm.setLayout(new CoordinateLayout(200, 480));
mainForm.setY(130);
mainForm.setX(0);
// Create buttons in the main form
final Button btnLoadXlet = new Button("Carregar um Xlet");
btnLoadXlet.setX(5);
btnLoadXlet.setY(0);
btnLoadXlet.setWidth(150);
final Button btnVideo = new Button("Tocar um video");
btnVideo.setX(5);
btnVideo.setY(35);
btnVideo.setWidth(150);
final Button btnSair = new Button("Sair");
btnSair.setX(5);
btnSair.setY(70);
btnSair.setWidth(150);
final Label lblIP = new Label("Voce pode conectar por ssh usando: root@" + Info.getIpAddress());
lblIP.setX(40);
lblIP.setY(305);
lblIP.setWidth(150);
// Criando actionListener
ActionListener listener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() == btnLoadXlet) {
loadForm.show();
mainForm.setVisible(true);
//mainForm.setY(100);
//btnSair.setVisible(false);
//mainForm.repaint();
} else if (evt.getSource() == btnVideo) {
videoForm.show();
mainForm.setVisible(true);
} else if (evt.getSource() == btnSair) {
exit();
}
}
};
// Adicionando actionListeners
btnLoadXlet.addActionListener(listener);
btnVideo.addActionListener(listener);
btnSair.addActionListener(listener);
mainForm.addComponent(btnLoadXlet);
mainForm.addComponent(btnVideo);
mainForm.addComponent(btnSair);
mainForm.addComponent(lblIP);
mainForm.setCommandListener(listener);