java.awt.TrayIcon.setImage()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(161)

本文整理了Java中java.awt.TrayIcon.setImage()方法的一些代码示例,展示了TrayIcon.setImage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TrayIcon.setImage()方法的具体详情如下:
包路径:java.awt.TrayIcon
类名称:TrayIcon
方法名:setImage

TrayIcon.setImage介绍

暂无

代码示例

代码示例来源:origin: igniterealtime/Openfire

trayIcon.setImage(onIcon.getImage());
trayIcon.setImage(offIcon.getImage());

代码示例来源:origin: stackoverflow.com

trayIcon.setImage(updatedImage);

代码示例来源:origin: magefree/mage

public synchronized void blink() {
  if (state == 0) {
    synchronized (MageTray.class) {
      if (state == 0) {
        state = 1;
        new Thread(() -> {
          try {
            int i = 0;
            while (state != 3) {
              trayIcon.setImage(i == 0 ? mainImage : flashedImage);
              TimeUnit.MILLISECONDS.sleep(600);
              i = i == 0 ? 1 : 0;
            }
            trayIcon.setImage(mainImage);
            state = 0;
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
        }).start();
      }
    }
  }
}

代码示例来源:origin: tomighty/tomighty

private void showTomatoIcon() {
  Image image = icons.tomato();
  trayIcon.setImage(image);
}

代码示例来源:origin: tomighty/tomighty

@Override
  public void receive(TimerTick tick) {
    if(options.ui().showTimeOnTray()) {
      Time time = tick.getTime();
      Image image = icons.time(time);
      trayIcon.setImage(image);
    }
  }
}

代码示例来源:origin: stackoverflow.com

Image img = trayIcon.getImage();
if (img == image) {
  trayIcon.setImage(image1);
} else {
  trayIcon.setImage(image);

代码示例来源:origin: igniterealtime/Spark

@Override
public void connectionClosedOnError(Exception arg0) {
  trayIcon.setImage(offlineIcon.getImage());
}
});

代码示例来源:origin: igniterealtime/Spark

@Override
public void connected( XMPPConnection xmppConnection ) {
  trayIcon.setImage( availableIcon.getImage() );
}

代码示例来源:origin: igniterealtime/Spark

@Override
public void connectionClosed() {
  trayIcon.setImage(offlineIcon.getImage());
}

代码示例来源:origin: igniterealtime/Spark

@Override
public void authenticated( XMPPConnection xmppConnection, boolean b ) {
  trayIcon.setImage( availableIcon.getImage() );
}

代码示例来源:origin: mguessan/davmail

public void run() {
    if (trayIcon.getImage().equals(image)) {
      trayIcon.setImage(activeImage);
    } else {
      trayIcon.setImage(image);
    }
  }
});

代码示例来源:origin: igniterealtime/Spark

private void changeSysTrayIcon() {
  if (pref.isTypingNotificationShown()) {
    trayIcon.setImage(typingIcon.getImage());
  }
}

代码示例来源:origin: blurpy/kouchat

/**
 * Sets the system tray icon if it's different from the icon already in use.
 *
 * @param icon The tray icon to use.
 */
public void setTrayIcon(final Image icon) {
  if (trayIcon.getImage() != icon) {
    trayIcon.setImage(icon);
  }
}

代码示例来源:origin: com.github.tornaia/aott-desktop-client-core

@EventListener(IgnoreUserEventsEvent.class)
public void ignoreUserEvents() {
  if (paused) {
    return;
  }
  Optional<TrayIcon> optionalSystemTrayIcon = getSystemTrayIcon();
  if (!optionalSystemTrayIcon.isPresent()) {
    LOG.error("Failed to set icon to ignored, tray icon was not found");
    return;
  }
  TrayIcon trayIcon = optionalSystemTrayIcon.get();
  trayIcon.setImage(imageUtils.createImage(Images.TRAY_ICON_IGNORED));
}

代码示例来源:origin: com.github.tornaia/aott-desktop-client-core

@EventListener(ConsiderUserEventsEvent.class)
public void considerUserEventsEvent() {
  if (paused) {
    return;
  }
  Optional<TrayIcon> optionalSystemTrayIcon = getSystemTrayIcon();
  if (!optionalSystemTrayIcon.isPresent()) {
    LOG.error("Failed to set icon to active, tray icon was not found");
    return;
  }
  TrayIcon trayIcon = optionalSystemTrayIcon.get();
  trayIcon.setImage(imageUtils.createImage(Images.TRAY_ICON));
}

代码示例来源:origin: SSilence/scotty

private void updateTrayIconIfSupported(boolean runs) {
  if (!isSupported()) {
    return;
  }
  if (runs) {
    icon.setImage(createImage(runningImage));
  } else {
    icon.setImage(createImage(defaultImage));
  }
}

代码示例来源:origin: trekawek/radioblock

public void toggleButton(boolean startEnabled) {
  startItem.setEnabled(startEnabled);
  stopItem.setEnabled(!startEnabled);
  icon.setImage(NORMAL_ICON);
}

代码示例来源:origin: igniterealtime/Spark

@Override
public void flashWindow(Window window) {
  if (pref.isSystemTrayNotificationEnabled()) {
    trayIcon.setImage(newMessageIcon.getImage());
    if (window instanceof JFrame) {
      ((JFrame) window).setTitle(getCounteredTitle(
          ((JFrame) window).getTitle(), chatMessageHandler.getUnreadMessages()));
    }
    newMessage = true;
  }
}

代码示例来源:origin: fr.jcgay.send-notification/send-notification

@Override
public void send(Notification notification) {
  if (!skipNotifications) {
    icon.setImage(createImage(notification.icon().toByteArray()));
    icon.displayMessage(notification.title(), notification.message(), toMessageType(notification.level()));
  }
}

代码示例来源:origin: jcgay/send-notification

@Override
public void send(Notification notification) {
  if (!skipNotifications) {
    icon.setImage(createImage(notification.icon().toByteArray()));
    icon.displayMessage(notification.title(), notification.message(), toMessageType(notification.level()));
  }
}

相关文章