@Override public boolean isSupported(Feature feature) { switch (feature) { case ICON_BADGE_NUMBER: case MENU: case PROGRESS_VALUE: case USER_ATTENTION: return true; default: return false; } }
@Override public void setIconBadge(String badge) { boolean visible = false; long val = 0; if (badge != null) { try { val = Long.parseLong(badge); visible = true; } catch (NumberFormatException e) { throw new UnsupportedOperationException("The " + Feature.ICON_BADGE_TEXT + " feature is not supported on the current platform!"); } } setBadge(val, visible); }
@Override public boolean isSupported(Feature feature) { switch(feature) { case ICON_BADGE_TEXT: case ICON_BADGE_NUMBER: case ICON_IMAGE: case MENU: case PROGRESS_VALUE: case USER_ATTENTION: return true; default: return false; } }
@Override public boolean isSupported(Feature feature) { switch(feature) { case ICON_BADGE_IMAGE_WINDOW: case PROGRESS_STATE_WINDOW: case PROGRESS_VALUE_WINDOW: return supported; case USER_ATTENTION_WINDOW: return true; default: return false; } }
public static void main(String[] args) { if (Taskbar.isTaskbarSupported()) { System.out.println("Taskbar is supported - feature support breakdown:"); Taskbar taskbar = Taskbar.getTaskbar(); stream(Feature.values()) .forEach(feature -> System.out.printf(" - %s: %s%n", feature, taskbar.isSupported(feature))); } else { System.out.println("Taskbar is not on your platform. :("); } }
/** * Tests support of {@code Feature} on current platform. * @param f feature to test * @return true if feature supported supported */ default public boolean isSupported(Feature f) { return false; }