Alert
Alert is a screen that displays data to the user and waits for a period of time before returning to the previous screen.
Alert Type:
Indicates the types of Alert objects to display.
Form
Form is a screen object that can be occupied by other items.
Work steps
Opening Netbeans already installed.
Select File, then select New Project.
Next select Java ME in Categories
Then choose Mobile Application on Project.
Next press the Next button.
After that give the project name.
Then Select Platform in Device Configuration: CLDC-1.0 and Device Profile: MIDP-2.0.
Finish
Program Files
Input :
import javax.microedition.midlet.;
import javax.microedition.lcdui.;
public class Midlet extends MIDlet implements CommandListener {
private Display display;
to display on the desktop
private Form form;
create new coding
private Alert alert;
create for show alert
private Command cmdkeluar;
for command exit
private Command cmdalert;
public Midlet(){
display = Display.getDisplay(this);
form = new Form("Contoh Alert");
form.append("Contoh teks didalam form");
cmdkeluar = new Command("end",Command.EXIT,1);
cmdalert = new Command("alert",Command.SCREEN,2);
form.addCommand(cmdkeluar);
form.addCommand (cmdalert);
form.setCommandListener(this);
}
public void startApp() {
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
private void showAlert(){
String info = "ini adalah contoh pesan"+
"atau informasi yang akan"+
"disampaikan kepada user";
# For show massage
alert = new Alert("Informasi",info,null,AlertType.ALARM);
alert.setTimeout(5000);
display.setCurrent(alert, form);
}
public void commandAction(Command c,Displayable s){
if(c == cmdkeluar){
destroyApp(true);
notifyDestroyed();
}else if (c == cmdalert){
showAlert();
}
}
}
Output :
The Final Result
Analysis Program
In this experimental program 4 is a program that uses the Alert object, the following syntax used in this experiment.
private Alert alert;
Syntax used as a Variable of Alert.private Form form;
This syntax is used as a Variable of the Form.
Conclusion
Alert is a screen that displays data to the user and waits for a period of time before returning to the previous screen.
Form is a screen object that can be occupied by other items.
Posted on Utopian.io - Rewarding Open Source Contributors
Your contribution cannot be approved yet because it is not as informative as other contributions. See the Utopian Rules. Please edit your contribution and add try to improve the length and detail of your contribution (or add more images/mockups/screenshots), to reapply for approval.
You may edit your post here, as shown below:
You can contact us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Ok, i have done fix my trouble , please re-check about my post and notice me if i need to fix another trouble
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hey @fakhriart I am @utopian-io. I have just upvoted you!
Achievements
Suggestions
Get Noticed!
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit