当前位置: 代码迷 >> J2SE >> Prohibited package name: java.awt 如何解决
  详细解决方案

Prohibited package name: java.awt 如何解决

热度:310   发布时间:2016-04-24 17:08:50.0
Prohibited package name: java.awt 怎么解决
代码如下:
package   prj_trayicon;

import   java.awt.*;
import   javax.swing.*;
import   com.borland.jbcl.layout.XYLayout;
import   com.borland.jbcl.layout.*;
import   java.awt.event.ActionEvent;
import   java.awt.event.ActionListener;
import   java.awt.event.WindowEvent;
import   java.awt.event.WindowAdapter;

public   class   FrmTrayIcon   extends   JFrame
{
    JPanel   contentPane;
    XYLayout   xYLayout1   =   new   XYLayout();
    JButton   jButton1   =   new   JButton();
    TrayIcon   ti;
    PopupMenu   popupMenu1   =   new   PopupMenu();
    MenuItem   menuItem1   =   new   MenuItem();
    MenuItem   menuItem2   =   new   MenuItem();

    public   FrmTrayIcon()
    {
        try
        {
            setDefaultCloseOperation(HIDE_ON_CLOSE);
            jbInit();
        }
        catch   (Exception   exception)
        {
            exception.printStackTrace();
        }
    }

    private   void   jbInit()   throws   Exception
    {
        contentPane   =   (JPanel)getContentPane();
        contentPane.setLayout(xYLayout1);
        setSize(new   Dimension(400,   300));
        setTitle( "TrayIcon ");
        this.addWindowListener(new   FrmTrayIcon_this_windowAdapter(this));
        jButton1.setText( "Exit ");
        jButton1.addActionListener(new   FrmTrayIcon_jButton1_actionAdapter(this));
        contentPane.add(jButton1,   new   XYConstraints(68,   48,   -1,   -1));
        menuItem1.setLabel( "Show ");
        menuItem1.addActionListener(new   FrmTrayIcon_menuItem1_actionAdapter(this));
        menuItem2.setLabel( "Exit ");
        menuItem2.addActionListener(new   FrmTrayIcon_menuItem2_actionAdapter(this));
        popupMenu1.add(menuItem1);
        popupMenu1.add(menuItem2);
        Image   image   =   Toolkit.getDefaultToolkit().getImage(this.getClass().getResource( "TrayIcon.png "));
        ti   =   new   TrayIcon(image,   "TrayIcon ",   popupMenu1);
    }

    public   void   jButton1_actionPerformed(ActionEvent   e)
    {
        System.exit(0);
    }

    public   void   this_windowClosing(WindowEvent   e)
    {
        if   (SystemTray.isSupported())
        {
            setVisible(false);
            MiniToTray();
        }
  相关解决方案