-
-
Save codenameone/4584f342783169899b34 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Form hi = new Form("ToastBarDemo", BoxLayout.y()); | |
Button basic = new Button("Basic"); | |
Button progress = new Button("Progress"); | |
Button expires = new Button("Expires"); | |
Button delayed = new Button("Delayed"); | |
hi.add(basic).add(progress).add(expires).add(delayed); | |
basic.addActionListener(e -> { | |
ToastBar.Status status = ToastBar.getInstance().createStatus(); | |
status.setMessage("Hello world"); | |
status.show(); | |
//... Some time later you must clear the status | |
// status.clear(); | |
}); | |
progress.addActionListener(e -> { | |
ToastBar.Status status = ToastBar.getInstance().createStatus(); | |
status.setMessage("Hello world"); | |
status.setShowProgressIndicator(true); | |
status.show(); | |
// ... Some time later you must clear it | |
}); | |
expires.addActionListener(e -> { | |
ToastBar.Status status = ToastBar.getInstance().createStatus(); | |
status.setMessage("Hello world"); | |
status.setExpires(3000); // only show the status for 3 seconds, then have it automatically clear | |
status.show(); | |
}); | |
delayed.addActionListener(e -> { | |
ToastBar.Status status = ToastBar.getInstance().createStatus(); | |
status.setMessage("Hello world"); | |
status.showDelayed(300); // Wait 300 ms to show the status | |
// ... Some time later, clear the status... this may be before it shows at all | |
}); | |
hi.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample usage of ToastBar.
From the Codename One project