本文整理汇总了Java中com.notification.types.IconNotification类的典型用法代码示例。如果您正苦于以下问题:Java IconNotification类的具体用法?Java IconNotification怎么用?Java IconNotification使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IconNotification类属于com.notification.types包,在下文中一共展示了IconNotification类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildNotification
import com.notification.types.IconNotification; //导入依赖的package包/类
@Override
public IconNotification buildNotification(ThemePackage pack, Object... args) {
if (args.length != 4)
throw new NotificationException("IconNotifications need three arguments: title, subtitle, icon!");
IconNotification note = new IconNotification();
note.setWindowTheme(pack.getTheme(WindowTheme.class));
note.setTextTheme(pack.getTheme(TextTheme.class));
note.setFrom((String) args[0]);
note.setTitle((String) args[1]);
note.setSubtitle((String) args[2]);
note.setIcon((Icon) args[3]);
return note;
}
示例2: buildNotification
import com.notification.types.IconNotification; //导入依赖的package包/类
@Override
public IconNotification buildNotification(ThemePackage pack, Object... args) {
if (args.length != 3)
throw new NotificationException("IconNotifications need three arguments: title, subtitle, icon!");
IconNotification note = new IconNotification();
note.setWindowTheme(pack.getTheme(WindowTheme.class));
note.setTextTheme(pack.getTheme(TextTheme.class));
note.setTitle((String) args[0]);
note.setSubtitle((String) args[1]);
note.setIcon((Icon) args[2]);
return note;
}
示例3: testIconNotification
import com.notification.types.IconNotification; //导入依赖的package包/类
@Test
public void testIconNotification() {
NotificationFactory factory = new NotificationFactory(s_pack);
IconNotification note = factory.buildIconNotification(TITLE, SUBTITLE, ICON);
assertEquals("IconNotification should have the same title", TITLE, note.getTitle());
assertEquals("IconNotification should have the same subtitle", SUBTITLE, note.getSubtitle());
assertEquals("IconNotification should have the same icon", ICON, note.getIcon());
}
示例4: getNotification
import com.notification.types.IconNotification; //导入依赖的package包/类
/**
* @return the notification
*/
public IconNotification getNotification() {
return notification;
}
示例5: setNotification
import com.notification.types.IconNotification; //导入依赖的package包/类
/**
* @param notification the notification to set
*/
public void setNotification(IconNotification notification) {
this.notification = notification;
}
示例6: main
import com.notification.types.IconNotification; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
// this will make the Notifications match the limits of the platform
// this will mean no fading on unix machines (since it doesn't look too good)
// Platform.instance().setAdjustForPlatform(true);
// makes a factory with the built-in clean dark theme
NotificationFactory factory = new NotificationFactory(ThemePackagePresets.cleanDark());
// a normal manager that just pops up the notification
NotificationManager plain = new SimpleManager(Location.NORTHWEST);
// a fade manager that will make the window fade in and out over a two second period
SimpleManager fade = new SimpleManager(Location.SOUTHWEST);
fade.setFadeEnabled(true);
fade.setFadeTime(Time.seconds(2));
// adds a text notification to the first manager
TextNotification notification = factory.buildTextNotification("This is the dark theme", "No fade");
notification.setCloseOnClick(true);
// the notification will stay there forever until you click it to exit
plain.addNotification(notification, Time.infinite());
Thread.sleep(2000);
// adds an icon notification that should fade in - note that results may vary depending on the platform
IconNotification icon = factory.buildIconNotification("This is a really really really long title", "See the cutoff?",
IconUtils.createIcon("/com/demo/exclamation.png", 50, 50));
fade.addNotification(icon, Time.seconds(2));
Thread.sleep(6000);
AcceptNotification accept = factory.buildAcceptNotification("Do you accept?", "This is a fading notification.");
fade.addNotification(accept, Time.infinite());
boolean didAccept = accept.blockUntilReply();
ProgressBarNotification reply = null;
if (didAccept) {
reply = factory.buildProgressBarNotification("You accepted");
} else {
reply = factory.buildProgressBarNotification("You did not accept");
}
reply.setCloseOnClick(true);
fade.addNotification(reply, Time.infinite());
for (int i = 0; i < 100; i++) {
reply.setProgress(i);
Thread.sleep(100);
}
fade.removeNotification(reply);
}
示例7: main
import com.notification.types.IconNotification; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
// this will make the Notifications match the limits of the platform
// this will mean no fading on unix machines (since it doesn't look too good)
// Platform.instance().setAdjustForPlatform(true);
// makes a factory with the built-in clean dark theme
NotificationFactory factory = new NotificationFactory(ThemePackagePresets.cleanDark());
// a normal manager that just pops up the notification
NotificationManager plain = new SimpleManager(Location.NORTHWEST);
// a fade manager that will make the window fade in and out over a two second period
SimpleManager fade = new SimpleManager(Location.SOUTHWEST);
fade.setFadeEnabled(true);
fade.setFadeTime(Time.seconds(2));
// adds a text notification to the first manager
TextNotification notification = factory.buildTextNotification("This is the dark theme",
"You can have multiple lines\nOf subtitle text as well\nLine 3");
notification.setCloseOnClick(true);
// the notification will stay there forever until you click it to exit
plain.addNotification(notification, Time.infinite());
Thread.sleep(2000);
// adds an icon notification that should fade in - note that results may vary depending on the platform
IconNotification icon = factory.buildIconNotification("This is a really really really long title", "See the cutoff?",
IconUtils.createIcon("/com/demo/exclamation.png", 50, 50));
fade.addNotification(icon, Time.seconds(2));
Thread.sleep(6000);
AcceptNotification accept = factory.buildAcceptNotification("Do you accept?", "This is a fading notification.");
fade.addNotification(accept, Time.infinite());
boolean didAccept = accept.blockUntilReply();
ProgressBarNotification reply = null;
if (didAccept) {
reply = factory.buildProgressBarNotification("You accepted");
} else {
reply = factory.buildProgressBarNotification("You did not accept");
}
reply.setCloseOnClick(true);
fade.addNotification(reply, Time.infinite());
for (int i = 0; i < 100; i++) {
reply.setProgress(i);
Thread.sleep(100);
}
fade.removeNotification(reply);
}
示例8: buildIconNotification
import com.notification.types.IconNotification; //导入依赖的package包/类
/**
* Builds an IconNotification.
*
* @param from
* the from field to display
* @param title
* the title to display on the IconNotification
* @param subtitle
* the subtitle to display on the IconNotification
* @param icon
* the icon on the IconNotification
* @return the built IconNotification
*/
public IconNotification buildIconNotification(String from, String title, String subtitle, ImageIcon icon) {
return build(IconNotification.class, from, title, subtitle, icon);
}
示例9: buildIconNotification
import com.notification.types.IconNotification; //导入依赖的package包/类
/**
* Builds an IconNotification.
*
* @param title
* the title to display on the IconNotification
* @param subtitle
* the subtitle to display on the IconNotification
* @param icon
* the icon on the IconNotification
* @return the built IconNotification
*/
public IconNotification buildIconNotification(String title, String subtitle, ImageIcon icon) {
return build(IconNotification.class, title, subtitle, icon);
}