Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This swing toast notifications use for java desktop application gui swing with flatlaf

sample darksample light

Install

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>

Getting started

  • 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}

Custom with flatlaf properties

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
KeyDescriptionValue TypeDefault values
Toast.outlineWidthint0
Toast.iconTextGapint5
Toast.closeButtonGapint5
Toast.arcint20
Toast.horizontalGapint10
Toast.limit-1 as unlimitedint-1
Toast.durationlong2500
Toast.animationint200
Toast.animationResolutionint5
Toast.animationMoveint10
Toast.minimumWidthint50
Toast.maximumWidth-1 as not setint-1
Toast.shadowColorColor
Toast.shadowOpacity0 to 1ffloat0.1f
Toast.shadowInsetsInsets0,0,6,6
Toast.useEffectbooleantrue
Toast.effectWidth0.5f as 50%float0.5f
Toast.effectOpacity0 to 1ffloat0.2f
Toast.effectAlignmentleft, rightStringleft
Toast.effectColorColor
Toast.success.effectColorColor
Toast.info.effectColorColor
Toast.warning.effectColorColor
Toast.error.effectColorColor
Toast.outlineColorColor
Toast.foregroundColor
Toast.backgroundColor
Toast.success.outlineColorColor
Toast.success.foregroundColor
Toast.success.backgroundColor
Toast.info.outlineColorColor
Toast.info.foregroundColor
Toast.info.backgroundColor
Toast.warning.outlineColorColor
Toast.warning.foregroundColor
Toast.warning.backgroundColor
Toast.error.outlineColorColor
Toast.error.foregroundColor
Toast.error.backgroundColor
Toast.frameInsetsInsets10,10,10,10
Toast.marginInsets8,8,8,8
Toast.showCloseButtonbooleantrue
Toast.closeIconColorColor

Using UI Manager

//  Using flatlaf extras to crate flat svg icon//  Use this code in main methodUIManager.put(ToastClientProperties.TOAST_INFO_ICON,newFlatSVGIcon("raven/toast/error.svg"));
KeyDescriptionValue Type
Toast.success.iconIcon
Toast.info.iconIcon
Toast.warning.iconIcon
Toast.error.iconIcon
Toast.closeIconIcon

Visit flatlaf for more

Update Note

  • version 1.0.1
    • add propertiesToast.maximumWidth
    • add propertiesToast.limit
    • add methodvoid clearHold() andvoid clearHold(Location location)

Fixed Note

  • version 1.0.1
    • fixed notification style properties background

About

Swing toast notifications use for java desktop application

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp