java.awt.Taskbar.Feature Java Examples

The following examples show how to use java.awt.Taskbar.Feature. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XTaskbarPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@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;
    }
}
 
Example #2
Source File: XTaskbarPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@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);
}
 
Example #3
Source File: CTaskbarPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@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;
    }
}
 
Example #4
Source File: WTaskbarPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@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;
    }
}
 
Example #5
Source File: DesktopFeatures.java    From demo-java-x with MIT License 5 votes vote down vote up
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. :(");
	}
}
 
Example #6
Source File: DownloadWindow.java    From xdm with GNU General Public License v2.0 4 votes vote down vote up
public void update(Downloader d, String file) {
	titleLbl.setText(file);
	if (d.getProgress() > 0) {
		setTitle("[" + d.getProgress() + "%]" + file);
	} else {
		setTitle(file);
	}
	String statTxt = "";
	if (d.isConverting()) {
		statTxt = StringResource.get("TITLE_CONVERT");
	} else if (d.isAssembling()) {
		statTxt = StringResource.get("STAT_ASSEMBLING");
	} else {
		statTxt = StringResource.get("STAT_DOWNLOADING");
	}
	lblStat.setText(statTxt);
	// StringBuilder sb = new StringBuilder();
	// sb.append((d.isAssembling() ? StringResource.get("STAT_ASSEMBLING")
	// : StringResource.get("DWN_DOWNLOAD")));
	// sb.append(" ");
	// sb.append(FormatUtilities.formatSize(d.getDownloaded()));
	// sb.append(" ");
	// sb.append(d.getType()==XDMConstants.HTTP?)

	lblDet.setText((d.isAssembling() ? StringResource.get("STAT_ASSEMBLING") : StringResource.get("DWN_DOWNLOAD"))
			+ " " + FormatUtilities.formatSize(d.getDownloaded()) + " "
			+ ((d.getType() == XDMConstants.HTTP || d.getType() == XDMConstants.DASH)
					? "/ " + FormatUtilities.formatSize(d.getSize())
					: "( " + d.getProgress() + " % )"));
	lblSpeed.setText(FormatUtilities.formatSize(d.getDownloadSpeed()) + "/s");
	lblETA.setText("ETA " + d.getEta());
	prgCircle.setValue(d.getProgress());
	SegmentDetails segDet = d.getSegmentDetails();
	long sz = ((d.getType() == XDMConstants.HTTP || d.getType() == XDMConstants.FTP
			|| d.getType() == XDMConstants.DASH) ? d.getSize() : 100);
	segProgress.setValues(segDet, sz);
	if (Taskbar.isTaskbarSupported()) {
		Taskbar taskbar = Taskbar.getTaskbar();
		if(taskbar.isSupported(Feature.PROGRESS_VALUE_WINDOW)) {
			taskbar.setWindowProgressValue(this, d.getProgress());
		}
	}

}
 
Example #7
Source File: TaskbarPeer.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * 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; }
 
Example #8
Source File: TaskbarPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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; }