- Notifications
You must be signed in to change notification settings - Fork19
Swing toast notifications use for java desktop application
License
NotificationsYou must be signed in to change notification settings
DJ-Raven/swing-toast-notifications
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This swing toast notifications use for java desktop application gui swing with flatlaf


This library not available in maven, try use jar file, by copy to the root project/library/swing-toast-notifications-1.0.3.jar
<dependency> <groupId>raven.toast</groupId> <artifactId>swing-toast-notifications</artifactId> <version>1.0.3</version> <scope>system</scope> <systemPath>${basedir}/library/swing-toast-notifications-1.0.3.jar</systemPath></dependency>
- Other library are use with this library
<dependency> <groupId>com.formdev</groupId> <artifactId>flatlaf</artifactId> <version>3.4.1</version></dependency><dependency> <groupId>com.formdev</groupId> <artifactId>flatlaf-extras</artifactId> <version>3.4.1</version></dependency>
- Import flatlaf library and flatlaf extras to your project
- And Import swing toast notifications
(check jar file in library folder)
// Setup notifications with jframNotifications.getInstance().setJFrame(jfram);// Show notificationsNotifications.getInstance().show(Notifications.Type.SUCCESS,Notifications.Location.TOP_CENTER,"Hello");// Show notification with custom componentNotifications.getInstance().show(newJButton("My Custom Button"));// Clear top right notificationsNotifications.getInstance().clear(Notifications.Location.TOP_RIGHT);// Clear all notificationsNotifications.getInstance().clearAll();
// Install flatlaf look and feel to your applicationFlatIntelliJLaf.setup();
// Notifications TypepublicenumType {SUCCESS,INFO,WARNING,ERROR}// Notification LocationpublicenumLocation {TOP_LEFT,TOP_CENTER,TOP_RIGHT,BOTTOM_LEFT,BOTTOM_CENTER,BOTTOM_RIGHT}
Create flatlaf file propertiesFlatLaf.properties
Toast.background=lighten(@background,5%)Toast.outlineWidth = 1Toast.success.foreground = rgb(53,198,203)Toast.frameInsets = 15,15,15,15
Key | Description | Value Type | Default values |
---|---|---|---|
Toast.outlineWidth | int | 0 | |
Toast.iconTextGap | int | 5 | |
Toast.closeButtonGap | int | 5 | |
Toast.arc | int | 20 | |
Toast.horizontalGap | int | 10 | |
Toast.limit | -1 as unlimited | int | -1 |
Toast.duration | long | 2500 | |
Toast.animation | int | 200 | |
Toast.animationResolution | int | 5 | |
Toast.animationMove | int | 10 | |
Toast.minimumWidth | int | 50 | |
Toast.maximumWidth | -1 as not set | int | -1 |
Toast.shadowColor | Color | ||
Toast.shadowOpacity | 0 to 1f | float | 0.1f |
Toast.shadowInsets | Insets | 0,0,6,6 | |
Toast.useEffect | boolean | true | |
Toast.effectWidth | 0.5f as 50% | float | 0.5f |
Toast.effectOpacity | 0 to 1f | float | 0.2f |
Toast.effectAlignment | left, right | String | left |
Toast.effectColor | Color | ||
Toast.success.effectColor | Color | ||
Toast.info.effectColor | Color | ||
Toast.warning.effectColor | Color | ||
Toast.error.effectColor | Color | ||
Toast.outlineColor | Color | ||
Toast.foreground | Color | ||
Toast.background | Color | ||
Toast.success.outlineColor | Color | ||
Toast.success.foreground | Color | ||
Toast.success.background | Color | ||
Toast.info.outlineColor | Color | ||
Toast.info.foreground | Color | ||
Toast.info.background | Color | ||
Toast.warning.outlineColor | Color | ||
Toast.warning.foreground | Color | ||
Toast.warning.background | Color | ||
Toast.error.outlineColor | Color | ||
Toast.error.foreground | Color | ||
Toast.error.background | Color | ||
Toast.frameInsets | Insets | 10,10,10,10 | |
Toast.margin | Insets | 8,8,8,8 | |
Toast.showCloseButton | boolean | true | |
Toast.closeIconColor | Color |
// Using flatlaf extras to crate flat svg icon// Use this code in main methodUIManager.put(ToastClientProperties.TOAST_INFO_ICON,newFlatSVGIcon("raven/toast/error.svg"));
Key | Description | Value Type |
---|---|---|
Toast.success.icon | Icon | |
Toast.info.icon | Icon | |
Toast.warning.icon | Icon | |
Toast.error.icon | Icon | |
Toast.closeIcon | Icon |
Visit flatlaf for more
version 1.0.1
- add properties
Toast.maximumWidth
- add properties
Toast.limit
- add method
void clearHold()
andvoid clearHold(Location location)
- add properties
version 1.0.1
- fixed notification style properties background
About
Swing toast notifications use for java desktop application
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.