java.awt.Taskbar#isTaskbarSupported ( )源码实例Demo

下面列出了java.awt.Taskbar#isTaskbarSupported ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ghidra   文件: GhidraApplicationConfiguration.java
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.
			}
		}
	}
 
源代码2 项目: ghidra   文件: StandAloneApplication.java
private void setDockIcon() {
	if (Taskbar.isTaskbarSupported()) {
		Taskbar taskbar = Taskbar.getTaskbar();
		if (taskbar.isSupported(Taskbar.Feature.ICON_IMAGE)) {
			taskbar.setIconImage(ApplicationInformationDisplayFactory.getLargestWindowIcon());
		}
	}
}
 
源代码3 项目: demo-java-x   文件: DesktopFeatures.java
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. :(");
	}
}
 
源代码4 项目: mzmine3   文件: DesktopSetup.java
@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");

}
 
源代码5 项目: xdm   文件: DownloadWindow.java
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());
		}
	}

}
 
 方法所在类
 同类方法