/** Shows current tweet dialog and downloads user image */ private void showTweet() { String text = current_tweet.getText(); if (text != null) { String from = current_tweet.getFromUser(); Alert a = new Alert("" + from, text, null, AlertType.INFO); a.setTimeout(Alert.FOREVER); display.setCurrent(a, this); String url = current_tweet.getProfileImageUrl(); if (url != null) { // download and set user image to visible alert Image img; InputStream is = null; try { is = Connector.openInputStream(url); img = Image.createImage(is); a.setImage(img); } catch (Throwable t) { // do not show errors if image // download fails } finally { try { if (is != null) { is.close(); } } catch (Throwable e) { } } } } }
public void tryAgain() { Alert error = new Alert("Login Incorrect", "Please try again", imge, AlertType.ERROR); error.setTimeout(900); error.setImage(imge); userName.setString(""); password.setString(""); display.setCurrent(error, form); }
public void showMsg() { Alert success = new Alert("Login Successfully", "Your Login Process is completed!", img2, AlertType.INFO); success.setImage(img2); userName.setString(""); password.setString(""); display.setCurrent(success, form); }
/** * Create a new Alert with the specified title, text, image, and alert type. * * @param title the title string * @param text the text string * @param image the image * @param type the alert type */ public Alert(String title, String text, Image image, AlertType type) { super(title); construct(); this.type = type; setImage(image); setString(text); setTimeout(getDefaultTimeout()); super.addCommand(DISMISS_COMMAND); super.setCommandListener(implicitListener); }
/** * Sets the type of the Alert. * * @param type an AlertType or null if it doesn't have a specific type */ public void setType(AlertType type) { this.type = type; if (text == null) { // show default text setString(text); } if (image == null) { // show default image setImage(image); } }