Java Code Examples for java.awt.Taskbar#isTaskbarSupported()
The following examples show how to use
java.awt.Taskbar#isTaskbarSupported() .
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: GhidraApplicationConfiguration.java From ghidra with Apache License 2.0 | 6 votes |
private static void platformSpecificFixups() { // Set the dock icon for macOS if (Taskbar.isTaskbarSupported()) { Taskbar taskbar = Taskbar.getTaskbar(); if (taskbar.isSupported(Taskbar.Feature.ICON_IMAGE)) { taskbar.setIconImage(ApplicationInformationDisplayFactory.getLargestWindowIcon()); } } // Set the application title for Linux. // This should not be necessary...hopefully in a future version of Java it will just work. Class<?> toolkitClass = Toolkit.getDefaultToolkit().getClass(); if (toolkitClass.getName().equals("sun.awt.X11.XToolkit")) { try { final Field awtAppClassName = toolkitClass.getDeclaredField("awtAppClassName"); awtAppClassName.setAccessible(true); awtAppClassName.set(null, "Ghidra"); } catch (Exception e) { // Not sure what went wrong. Oh well, we tried. } } }
Example 2
Source File: StandAloneApplication.java From ghidra with Apache License 2.0 | 5 votes |
private void setDockIcon() { if (Taskbar.isTaskbarSupported()) { Taskbar taskbar = Taskbar.getTaskbar(); if (taskbar.isSupported(Taskbar.Feature.ICON_IMAGE)) { taskbar.setIconImage(ApplicationInformationDisplayFactory.getLargestWindowIcon()); } } }
Example 3
Source File: DesktopFeatures.java From demo-java-x with MIT License | 5 votes |
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 4
Source File: DesktopSetup.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
@Override public void run() { logger.finest("Configuring desktop settings"); // Set basic desktop handlers final Desktop awtDesktop = Desktop.getDesktop(); if (awtDesktop != null) { // Setup About handler if (awtDesktop.isSupported(Desktop.Action.APP_ABOUT)) { awtDesktop.setAboutHandler(e -> { MZmineGUI.showAboutWindow(); }); } // Setup Quit handler if (awtDesktop.isSupported(Desktop.Action.APP_QUIT_HANDLER)) { awtDesktop.setQuitHandler((e, response) -> { ExitCode exitCode = MZmineCore.getDesktop().exitMZmine(); if (exitCode == ExitCode.OK) response.performQuit(); else response.cancelQuit(); }); } } if (Taskbar.isTaskbarSupported()) { final Taskbar taskBar = Taskbar.getTaskbar(); // Set the main app icon if ((mzMineIcon != null) && taskBar.isSupported(Taskbar.Feature.ICON_IMAGE)) { final java.awt.Image mzMineIconAWT = SwingFXUtils.fromFXImage(mzMineIcon, null); taskBar.setIconImage(mzMineIconAWT); } // Add a task controller listener to show task progress MZmineCore.getTaskController().addTaskControlListener((numOfWaitingTasks, percentDone) -> { if (numOfWaitingTasks > 0) { if (taskBar.isSupported(Taskbar.Feature.ICON_BADGE_NUMBER)) { String badge = String.valueOf(numOfWaitingTasks); taskBar.setIconBadge(badge); } if (taskBar.isSupported(Taskbar.Feature.PROGRESS_VALUE)) taskBar.setProgressValue(percentDone); } else { if (taskBar.isSupported(Taskbar.Feature.ICON_BADGE_NUMBER)) taskBar.setIconBadge(null); /* * if (taskBar.isSupported( Taskbar.Feature.PROGRESS_STATE_WINDOW)) * taskBar.setWindowProgressState( MZmineCore.getDesktop().getMainWindow(), * Taskbar.State.OFF); */ if (taskBar.isSupported(Taskbar.Feature.PROGRESS_VALUE)) taskBar.setProgressValue(-1); /* * if (taskBar.isSupported( Taskbar.Feature.PROGRESS_VALUE_WINDOW)) * taskBar.setWindowProgressValue( MZmineCore.getDesktop().getMainWindow(), -1); */ } }); } // Let the OS decide the location of new windows. Otherwise, all windows // would appear at the top left corner by default. // TODO: investigate if this applies to JavaFX windows System.setProperty("java.awt.Window.locationByPlatform", "true"); }
Example 5
Source File: DownloadWindow.java From xdm with GNU General Public License v2.0 | 4 votes |
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()); } } }