Java实现托盘管理Java认证考试
文章作者 100test 发表时间 2010:04:28 22:41:24
来源 100Test.Com百考试题网
import java.awt.AWTException.
import java.awt.Image.
import java.awt.MenuItem.
import java.awt.PopupMenu.
import java.awt.SystemTray.
import java.awt.Toolkit.
import java.awt.TrayIcon.
import java.awt.event.ActionEvent.
import java.awt.event.ActionListener.
import java.awt.event.MouseEvent.
import java.net.URL.
import javax.swing.ImageIcon.
import javax.swing.JFrame.
import javax.swing.JLabel.
public class SystemTrayDemo extends JFrame {
private TrayIcon trayIcon = null.
public SystemTrayDemo() {
this.setTitle("系统托盘的例子").
jbInit().
this.setSize(200, 250).
this.setLocation(300, 300).
}
public void jbInit() {
if (SystemTray.isSupported()) { // 检查当前系统是否支持系统托盘
SystemTray tray = SystemTray.getSystemTray().// 获取表示桌面托盘区的