Segue códigos …que por via alguns são gerados automaticamente pelo NetBeans !!!
Tela de Splash.
public SplashScreen getSplashScreen() {
if (splashScreen == null) {
// write pre-init user code here
splashScreen = new SplashScreen(getDisplay());
splashScreen.setTitle("Aquariu\'s Imaginary!");
splashScreen.setCommandListener(this);
splashScreen.setImage(getImage2());
splashScreen.setText("Aquariu\'s Imaginary - Portable");
splashScreen.setTimeout(2000);
// write post-init user code here
}
return splashScreen;
Tela de Login.
public LoginScreen getLoginScreen() {
if (loginScreen == null) {
// write pre-init user code here
loginScreen = new LoginScreen(getDisplay());
loginScreen.setLabelTexts("Nome do usu\u00E1rio", "Senha");
loginScreen.setTitle("Aquariu\'s Imaginary - Login");
loginScreen.addCommand(LoginScreen.LOGIN_COMMAND);
loginScreen.addCommand(getExitCommand());
loginScreen.setCommandListener(this);
loginScreen.setBGColor(-16724788);
loginScreen.setFGColor(0);
loginScreen.setPassword("");
loginScreen.setUsername("");
loginScreen.setUseLoginButton(false);
loginScreen.setLoginButtonText("Login");
// write post-init user code here
}
return loginScreen;
}
Uma tela de Espera.
public WaitScreen getWaitScreen() {
if (waitScreen == null) {
// write pre-init user code here
waitScreen = new WaitScreen(getDisplay());
waitScreen.setTitle("");
waitScreen.setCommandListener(this);
waitScreen.setImage(getImage3());
waitScreen.setText("Por favor, aguarde !!!");
waitScreen.setTask(getTask());
// write post-init user code here
}
return waitScreen;
}
Alerta de falha (na qual caso haja retorna para tela de login)
public Alert getAlertFalha() {
if (alertFalha == null) {
// write pre-init user code here
alertFalha = new Alert("Alerta de erro !", "Erro !!", getImage5(), null);
alertFalha.setTimeout(Alert.FOREVER);
// write post-init user code here
}
return alertFalha;
}
Alerta de sucesso (Na qual caindo nessa vai direto para a tela “Lista”)
public Alert getAlertSucesso() {
if (alertSucesso == null) {
// write pre-init user code here
alertSucesso = new Alert("Logado com sucesso!", "Bem vindo !", getImage4(), AlertType.CONFIRMATION);
alertSucesso.setTimeout(Alert.FOREVER);
// write post-init user code here
}
return alertSucesso;
}
Minha lista que dentro dela tenho 2 comandos de tela nos quais são Sair (Sai do sistema) e Visualizar (Botão no qual voce visualiza os dados apresentados na lista em textbox em um outro formulario.
//Codigo da lista em si
public List getLista() {
if (lista == null) {
lista = new List("Lista de tanques!", Choice.EXCLUSIVE);
lista.addCommand(getCm_sair());
lista.addCommand(getCm_visualiza());
lista.setCommandListener(this);
}
return lista;
}
//Comand Action dos botoes.
public void commandAction(Command command, Displayable displayable) {
// write pre-action user code here
if (displayable == form_tanque) {
if (command == cm_gravar) {
} else if (command == cm_voltar) {
switchDisplayable(null, getLista());
}
} else if (displayable == lista) {
if (command == List.SELECT_COMMAND) {
listaAction();
} else if (command == cm_sair) {
switchDisplayable(null, getSplashFim());
} else if (command == cm_visualiza) {
switchDisplayable(null, getForm_tanque());
String dados_tan= lista.getString(lista.getSelectedIndex());
StringTokenizer separador = new StringTokenizer( dados_tan, ";" );
int i = separador.countTokens();
nome_tanque = separador.nextToken();
nome_especie = separador.nextToken();
nome_alimento = separador.nextToken();
nome_qtde = separador.nextToken();
nome_period = separador.nextToken();
tf_nomet.setString(nome_tanque);
tf_especie.setString(nome_especie);
tf_alimento.setString(nome_alimento);
tf_qtde.setString(nome_qtde);
tf_period.setString(nome_period);
}