亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tray.java

?? java GUI編程
?? JAVA
字號:
/*
 * Copyright (C) 2004 Sun Microsystems, Inc. All rights reserved. Use is
 * subject to license terms.
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the Lesser GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA.
 */

import org.jdesktop.jdic.tray.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;


public class Tray implements ActionListener, ItemListener {

    SystemTray tray = SystemTray.getDefaultSystemTray();
    TrayIcon ti;
    JFrame frame;
    public Tray() {

        JPopupMenu menu;
        JMenu  submenu;
        JMenuItem menuItem;
        JRadioButtonMenuItem rbMenuItem;
        JCheckBoxMenuItem cbMenuItem;
        
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception e) {
            e.printStackTrace();
        }
        if( Integer.parseInt(System.getProperty("java.version").substring(2,3)) >=5 )
            System.setProperty("javax.swing.adjustPopupLocationToFit", "false");
        menu = new JPopupMenu("A Menu");
        
        // a group of JMenuItems
        menuItem = new JMenuItem("A text-only menu item", KeyEvent.VK_T);
        // menuItem.setMnemonic(KeyEvent.VK_T); //used constructor instead
        menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1,
                ActionEvent.CTRL_MASK));
        menuItem.getAccessibleContext().setAccessibleDescription("This doesn't really do anything");
        menuItem.addActionListener(this);
        menu.add(menuItem);

        // ImageIcon icon = new ImageIcon("middle.gif");
        ImageIcon icon = new ImageIcon(Tray.class.getResource("images/middle.gif"));

        menuItem = new JMenuItem("Both text and icon", icon);
        menuItem.setMnemonic(KeyEvent.VK_B);
        menuItem.addActionListener(this);
        menu.add(menuItem);

        menuItem = new JMenuItem(icon);
        menuItem.setMnemonic(KeyEvent.VK_D);
        menuItem.addActionListener(this);
        menu.add(menuItem);

        // a group of radio button menu items
        menu.addSeparator();
        ButtonGroup group = new ButtonGroup();

        rbMenuItem = new JRadioButtonMenuItem("A radio button menu item");
        rbMenuItem.setSelected(true);
        rbMenuItem.setMnemonic(KeyEvent.VK_R);
        group.add(rbMenuItem);
        rbMenuItem.addActionListener(this);
        menu.add(rbMenuItem);

        rbMenuItem = new JRadioButtonMenuItem("Another one");
        rbMenuItem.setMnemonic(KeyEvent.VK_O);
        group.add(rbMenuItem);
        rbMenuItem.addActionListener(this);
        menu.add(rbMenuItem);

        // a group of check box menu items
        menu.addSeparator();
        cbMenuItem = new JCheckBoxMenuItem("A check box menu item");
        cbMenuItem.setMnemonic(KeyEvent.VK_C);
        cbMenuItem.addItemListener(this);
        menu.add(cbMenuItem);

        cbMenuItem = new JCheckBoxMenuItem("Another one");
        cbMenuItem.setMnemonic(KeyEvent.VK_H);
        cbMenuItem.addItemListener(this);
        menu.add(cbMenuItem);

        // a submenu
        menu.addSeparator();
        submenu = new JMenu("A submenu");
        submenu.setMnemonic(KeyEvent.VK_S);

        menuItem = new JMenuItem("An item in the submenu");
        menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2,
                ActionEvent.CTRL_MASK));
        menuItem.addActionListener(this);
        submenu.add(menuItem);

        menuItem = new JMenuItem("Another item");
        menuItem.addActionListener(this);
        submenu.add(menuItem);
        menu.add(submenu);

        // "Quit" menu item
        menu.addSeparator();
        menuItem = new JMenuItem("Quit");
        menuItem.addActionListener(this);
        menu.add(menuItem);
        
        // ImageIcon i = new ImageIcon("duke.gif");
        ImageIcon i = new ImageIcon(Tray.class.getResource("images/duke.gif"));

        ti = new TrayIcon(i, "JDIC Tray Icon API Demo - TrayIcon", menu);

        ti.setIconAutoSize(true);
        ti.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            	frame.setVisible(!frame.isVisible());
            }
        });
        ti.addBalloonActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e) {
              JOptionPane.showMessageDialog(null, 
              "Balloon Message been clicked - TrayIcon", "Message",
              JOptionPane.INFORMATION_MESSAGE);
            }
        });
        
        tray.addTrayIcon(ti);
        
        // Construct the GUI for balloon message.
        frame = new JFrame("Show Balloon Message");
        frame.getContentPane().setLayout(new BorderLayout());
        frame.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
        
        JPanel topPanel = new JPanel();
        topPanel.setBorder(BorderFactory.createEtchedBorder());
        topPanel.setLayout(new BorderLayout());
        topPanel.add(new JLabel("Caption: "), BorderLayout.WEST);
        final JTextField captionField = new JTextField("JDIC TrayIcon"); 
        topPanel.add(captionField, BorderLayout.CENTER);
        JPanel typePanel = new JPanel();
        final JComboBox typeBox = new JComboBox(new String[]{"INFO", "ERROR", "WARNING", "NONE" });
        typePanel.add(new JLabel(" Type:"), BorderLayout.WEST);
        typePanel.add(typeBox, BorderLayout.EAST);
        topPanel.add(typePanel, BorderLayout.EAST);
        frame.getContentPane().add(topPanel, BorderLayout.NORTH);
        
        JPanel messagePanel = new JPanel();
        messagePanel.setLayout(new BorderLayout());
        messagePanel.add(new JLabel("Message:"), BorderLayout.NORTH);
        final JTextArea messageArea = new JTextArea(5, 20); 
        messageArea.setText("This is a balloon message.\nYou can set the caption, message, \nand message type");
        messageArea.setBorder(BorderFactory.createEtchedBorder());
        messagePanel.add(messageArea);
        frame.getContentPane().add(messagePanel, BorderLayout.CENTER);
        
        JPanel buttonPanel = new JPanel();
        final JButton okButton = new JButton("OK");
        final JButton cancelButton = new JButton("Cancel");
        ActionListener al = new ActionListener(){
			public void actionPerformed(ActionEvent e) {
				if(e.getSource() == cancelButton)
					frame.setVisible(false);
				else if(e.getSource() == okButton){
					ti.displayMessage(captionField.getText(), messageArea.getText(), typeBox.getSelectedIndex());
				}
			}
        };
        okButton.addActionListener(al);
        cancelButton.addActionListener(al);
        buttonPanel.add(okButton);
        buttonPanel.add(cancelButton);
        frame.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }

    // Returns just the class name -- no package info.
    protected String getClassName(Object o) {
        String classString = o.getClass().getName();
        int dotIndex = classString.lastIndexOf(".");

        return classString.substring(dotIndex + 1);
    }

    public void actionPerformed(ActionEvent e) {
        JMenuItem source = (JMenuItem) (e.getSource());
        String s = source.getText();
        if (s.equalsIgnoreCase("Quit")) {
            System.out.println("Quit menu item selected!");
            System.exit(0);
        } else {
            s = "Action event detected." + "\n" + "    Event source: "
                + source + " (an instance of " + getClassName(source) + ")";

            System.out.println(s);
        }
    }

    public void itemStateChanged(ItemEvent e) {
        JMenuItem source = (JMenuItem) (e.getSource());
        String s = "Item event detected." + "\n" + "    Event source: "
                + source.getText() + " (an instance of " + getClassName(source)
                + ")" + "\n" + "    New state: "
                + ((e.getStateChange() == ItemEvent.SELECTED)
                        ? "selected"
                        : "unselected");

        System.out.println(s);
    }

    public static void main(String[] args) {
        new Tray();
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99国内精品久久| 国产精品小仙女| 欧美最猛黑人xxxxx猛交| 亚洲同性gay激情无套| 99国产一区二区三精品乱码| 亚洲女人小视频在线观看| 色综合久久久久综合体桃花网| 一区二区在线免费| 日韩欧美中文一区| 国产又黄又大久久| 亚洲欧洲av在线| 日本丰满少妇一区二区三区| 午夜在线电影亚洲一区| 亚洲精品一区二区三区在线观看| 国产精品99久| 亚洲欧美日韩国产另类专区 | 自拍偷在线精品自拍偷无码专区| 91麻豆蜜桃一区二区三区| 性感美女久久精品| 久久久精品国产99久久精品芒果 | 欧洲亚洲精品在线| 日本不卡视频在线观看| 国产欧美日产一区| 欧美日免费三级在线| 免费日韩伦理电影| 国产精品久久久久久久久免费丝袜| 91久久国产综合久久| 同产精品九九九| 国产欧美1区2区3区| 911国产精品| aaa国产一区| 麻豆成人av在线| 懂色av一区二区夜夜嗨| 依依成人综合视频| 久久嫩草精品久久久精品| 91黄视频在线| 国产白丝精品91爽爽久久| 日本在线观看不卡视频| 欧美经典一区二区| 欧美一级黄色片| 色悠悠久久综合| 国产不卡视频在线观看| 美女视频网站久久| 亚洲成人黄色影院| 亚洲日本韩国一区| 久久久久国产免费免费 | 老司机精品视频导航| 亚洲免费av高清| 国产欧美综合在线| 日韩免费性生活视频播放| 日本韩国精品一区二区在线观看| 国产经典欧美精品| 麻豆精品视频在线观看免费| 亚洲午夜视频在线观看| 亚洲人成网站精品片在线观看 | 69堂精品视频| 欧美视频中文字幕| 91日韩精品一区| 不卡一区在线观看| 国产麻豆精品久久一二三| 日产国产高清一区二区三区| 亚洲国产精品久久久久婷婷884| 国产精品伦一区二区三级视频| 欧美成人一区二区三区| 欧美撒尿777hd撒尿| 欧美综合一区二区| 91麻豆国产福利在线观看| 99视频在线精品| 不卡的电影网站| av资源站一区| 91色视频在线| 欧洲国产伦久久久久久久| 91精彩视频在线| 欧美三级视频在线观看| 欧美在线免费观看亚洲| 欧美性欧美巨大黑白大战| 色综合久久天天综合网| 91国产成人在线| 欧美性色黄大片| 欧美日高清视频| 91精品麻豆日日躁夜夜躁| 亚洲精品欧美二区三区中文字幕| 亚洲特黄一级片| 亚洲午夜一区二区| 蜜桃久久久久久久| 韩国v欧美v日本v亚洲v| 国产经典欧美精品| 91性感美女视频| 欧美网站一区二区| 日韩写真欧美这视频| 久久综合久久综合亚洲| 欧美激情综合五月色丁香小说| 中文字幕色av一区二区三区| 亚洲一区二区综合| 美国十次了思思久久精品导航| 精品一区二区三区久久久| 国产99久久久国产精品潘金网站| 成人av在线资源网站| 欧美中文字幕不卡| 日韩三级.com| 国产精品黄色在线观看| 亚洲精品精品亚洲| 日本不卡一区二区三区| 成人h动漫精品| 欧美性淫爽ww久久久久无| 91精品国产乱| 国产精品久久久久久久久免费樱桃 | 青娱乐精品在线视频| 国产一区在线精品| 色婷婷一区二区| 久久亚洲综合av| 一区二区免费视频| 国产一区二区女| 欧美亚洲精品一区| 国产亚洲欧美日韩在线一区| 亚洲一区二区欧美日韩| 国产伦精一区二区三区| 91蝌蚪国产九色| 欧美成人一区二区三区片免费 | 美日韩一区二区三区| 91在线免费播放| 欧美成人aa大片| 一区二区三区国产精华| 国产伦精品一区二区三区免费迷| 在线精品亚洲一区二区不卡| 26uuu欧美| 亚洲午夜一二三区视频| 成人毛片在线观看| 日韩欧美一区中文| 亚洲伦理在线精品| 国产精品小仙女| 91精品国产综合久久精品| 亚洲视频在线一区观看| 狠狠色丁香九九婷婷综合五月| 欧美在线视频你懂得| 日本一二三四高清不卡| 免费欧美日韩国产三级电影| 在线视频中文字幕一区二区| 日本一区二区三区高清不卡| 奇米888四色在线精品| 欧美亚洲综合另类| 日韩理论片一区二区| 国产91高潮流白浆在线麻豆| 欧美一区中文字幕| 亚洲一区二区三区四区中文字幕| 成人精品视频一区二区三区| 日韩欧美第一区| 视频一区视频二区中文| 色999日韩国产欧美一区二区| 国产精品激情偷乱一区二区∴| 国产一区不卡在线| 日韩一区二区三区视频在线观看| 夜夜夜精品看看| 色嗨嗨av一区二区三区| 亚洲视频1区2区| 成人激情黄色小说| 国产精品拍天天在线| 国产成人99久久亚洲综合精品| 亚洲精品一区二区三区99| 久久精品国产澳门| 欧美mv和日韩mv的网站| 全国精品久久少妇| 日韩欧美一区二区久久婷婷| 天堂在线一区二区| 51精品视频一区二区三区| 三级不卡在线观看| 8x福利精品第一导航| 日韩不卡免费视频| 欧美不卡视频一区| 狠狠色综合日日| 国产偷国产偷精品高清尤物| 国产高清一区日本| 国产精品美女久久久久久久久 | 欧美xxxxx裸体时装秀| 久久99久久99精品免视看婷婷 | 欧美日韩情趣电影| 日韩vs国产vs欧美| 日韩免费看网站| 国产麻豆午夜三级精品| 欧美国产综合一区二区| 不卡区在线中文字幕| 亚洲一二三四区| 欧美一区二区免费| 国产 日韩 欧美大片| 最新不卡av在线| 欧美精品三级在线观看| 久久精品国产99国产| 国产日韩欧美麻豆| 一本久久a久久精品亚洲| 亚洲6080在线| 久久婷婷色综合| 成人午夜电影久久影院| 亚洲激情图片qvod| 日韩欧美国产一区二区三区| 国产成人亚洲综合色影视| 亚洲日本欧美天堂| 日韩午夜中文字幕| 99r国产精品| 另类中文字幕网| 中文字幕五月欧美|