本文整理汇总了Java中com.notification.types.ProgressBarNotification.setProgress方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressBarNotification.setProgress方法的具体用法?Java ProgressBarNotification.setProgress怎么用?Java ProgressBarNotification.setProgress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.notification.types.ProgressBarNotification
的用法示例。
在下文中一共展示了ProgressBarNotification.setProgress方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: progressBarShouldNotExceed100
import com.notification.types.ProgressBarNotification; //导入方法依赖的package包/类
@Test
public void progressBarShouldNotExceed100() {
ProgressBarNotification note = new ProgressBarNotification();
note.setProgress(123);
assertEquals("ProgressBarNotification should not exceed 100 progress", 100, note.getProgress());
}
示例2: progressBarShouldNotGoBelow0
import com.notification.types.ProgressBarNotification; //导入方法依赖的package包/类
@Test
public void progressBarShouldNotGoBelow0() {
ProgressBarNotification note = new ProgressBarNotification();
note.setProgress(-10);
assertEquals("ProgressBarNotification should not go below 0 progress", 0, note.getProgress());
}
示例3: main
import com.notification.types.ProgressBarNotification; //导入方法依赖的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);
}
示例4: main
import com.notification.types.ProgressBarNotification; //导入方法依赖的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);
}