| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1962 人关注过本帖
标题:编译出现警告信息!
只看楼主 加入收藏
fqj793
Rank: 1
等 级:新手上路
威 望:2
帖 子:228
专家分:0
注 册:2006-12-9
收藏
 问题点数:0 回复次数:5 
编译出现警告信息!
在执行javac JXCFrame.java时,出现警告信息,不是很明了!
图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: 编译 警告 
2008-11-27 14:11
fqj793
Rank: 1
等 级:新手上路
威 望:2
帖 子:228
专家分:0
注 册:2006-12-9
收藏
得分:0 
这是也书本上的一个例题!

知识改变命运!!!
2008-11-27 14:15
freish
Rank: 6Rank: 6
等 级:贵宾
威 望:23
帖 子:1223
专家分:437
注 册:2007-6-1
收藏
得分:0 
有什么关系呢!

如果你书上没有警告信息那么就是你的jdk版本比书上用的高

[url=http://shop63425653./]/cvbnm/a6/1d/f4/7dd1720119cf3b1dcfb570b467b24051.jpg" border="0" />[/url]
2008-11-27 17:20
Ethip
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:771
专家分:0
注 册:2008-1-18
收藏
得分:0 
看看源代码?
2008-11-28 16:24
fqj793
Rank: 1
等 级:新手上路
威 望:2
帖 子:228
专家分:0
注 册:2006-12-9
收藏
得分:0 
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.
import java.awt.
import java.beans.PropertyVetoException;
import java.lang.reflect.Constructor;
import
import java.util.HashMap;
import java.util.Map;
import java.awt.event.*;
import java.awt.*;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BoxLayout;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.border.BevelBorder;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;


public class JXCFrame
{
    private JPanel sysManagePanel;
    private JDesktopPane deskPane;
    private JFrame fram;
    private JLabel backlabel;
    
    private Map<String ,JInternalFrame>  ifs=new HashMap<String,JInternalFrame>();
    
    public JXCFrame()
    {
        fram=new JFrame("企业进销存管理系统");
        fram.getContentPane().setBackground(new Color(170,188,120));
        fram.addComponentListener(new FrameListener());
        fram.getContentPane().setLayout(new BorderLayout());
        fram.setBounds(100,100,800,600);
        fram.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        backlabel=new JLabel();
        backlabel.setVerticalAlignment(SwingConstants.TOP);
        backlabel.setHorizontalAlignment(SwingConstants.CENTER);
        updateBackImage();
        deskPane=new JDesktopPane();
        deskPane.add(backlabel,new Integer(Integer.MIN_VALUE));
        fram.getContentPane().add(deskPane);
        JTabbedPane navipane=createNavigationPane();
        fram.getContentPane().add(navipane,BorderLayout.NORTH);
        fram.setVisible(true);
    }
    public static void main(String[] args)
    {
        SwingUtilities.invokeLater(new Runnable()
        {
            public void run()
            {
                //new Login();
                new JXCFrame();
            }
        });
    }
    private final class FrameListener extends ComponentAdapter {
        public void componentResized(final ComponentEvent e) {
            updateBackImage();
        }
    }
    
    private void updateBackImage()
    {
        if(backlabel!=null)
        {
            int backw = JXCFrame.this.fram.getWidth();
            int backh = fram.getHeight();
            backlabel.setSize(backw, backh);
            backlabel.setText("<html><body><image width='" + backw
                    + "' height='" + (backh - 110) + "' src="
                    + JXCFrame.this.getClass().getResource("welcome.jpg")
                    + "'></img></body></html>");}
    }
    
    private JTabbedPane createNavigationPane()
    {
        JTabbedPane tabpane=new JTabbedPane();
        tabpane.setFocusable(false);
        tabpane.setBackground(new Color(200,110,189));
        tabpane.setBorder(new BevelBorder(BevelBorder.RAISED));
        
    JPanel baseManagerPane=new JPanel();
    baseManagerPane.setLayout(new BoxLayout(baseManagerPane,BoxLayout.X_AXIS));
    baseManagerPane.setBackground(new Color(220,110,230));
   
    baseManagerPane.add(createFrameButton("客户信息管理","kehugl"));
    baseManagerPane.add(createFrameButton("商品信息管理","shuangpigl"));
    baseManagerPane.add(createFrameButton("供应商信息管理","gysgl"));
    /*JButton jb=new JButton("test");
    baseManagerPane.add(jb);
    jb.addActionListener(new ActionListener()
    {
        public void actionPerformed(ActionEvent e)
        {
            JPanel jp=new JPanel();
            jp.setBounds(100,100,200,150);
            jp.setVisible(true);
            JInternalFrame jf=new QuanManager();
            jf.setVisible(true);
            try
            {
              jf.setSelected(true);
          }
          catch(Exception ex)
          {
              System.out.println("jF");
          }
            //JOptionPane.showMessageDialog(null,"ad","cd",JOptionPane.INFORMATION_MESSAGE);
        }
    });*/
   
    JPanel kucunManager=new JPanel();
    kucunManager.setLayout(new BoxLayout(kucunManager,BoxLayout.X_AXIS));
    kucunManager.setBackground(new Color(220,110,230));
   
    kucunManager.add(createFrameButton("库存盘点","kcpd"));
    kucunManager.add(createFrameButton("价格调整","jgtz"));
   
    JPanel sellManage=new JPanel();
    sellManage.setLayout(new BoxLayout(sellManage,BoxLayout.X_AXIS));
    sellManage.setBackground(new Color(220,110,230));
   
    sellManage.add(createFrameButton("销售单","xsd"));
    sellManage.add(createFrameButton("销售退货","xsth"));
   
    JPanel chaxunManager=new JPanel();
    chaxunManager.setLayout(new BoxLayout(chaxunManager,BoxLayout.X_AXIS));
    chaxunManager.setBackground(new Color(220,110,230));
   
    chaxunManager.add(createFrameButton("客户信息查询", "KeHuChaXun"));
    chaxunManager.add(createFrameButton("商品信息查询", "SPhaXun"));
    chaxunManager.add(createFrameButton("供应商信息查询", "GYSChaXun"));
    chaxunManager.add(createFrameButton("销售信息查询", "XiaoShouChaXun"));
        chaxunManager.add(createFrameButton("销售退货查询","XiaoShouTuiHuoChaXun"));
        chaxunManager.add(createFrameButton("入库查询", "RuKuChaXun"));
        chaxunManager.add(createFrameButton("入库退货查询", "RuKuTuiHuoChaXun"));
        chaxunManager.add(createFrameButton("销售排行", "XiaoShouPaiHang"));
        
        JPanel stockManagePanel = new JPanel();// 进货管理面板
        stockManagePanel.setBackground(new Color(215, 223, 194));
        stockManagePanel.setLayout(new BoxLayout(stockManagePanel,BoxLayout.X_AXIS));
        stockManagePanel.add(createFrameButton("进货单", "JinHuoDan"));
        stockManagePanel.add(createFrameButton("进货退货", "JinHuoTuiHuo"));

        sysManagePanel = new JPanel();// 系统管理面板
        sysManagePanel.setBackground(new Color(215, 223, 194));
        sysManagePanel.setLayout(new BoxLayout(sysManagePanel, BoxLayout.X_AXIS));
        sysManagePanel.add(createFrameButton("操作员管理", "CzyGL"));
        sysManagePanel.add(createFrameButton("更改密码", "GengGaiMiMa"));
        sysManagePanel.add(createFrameButton("权限管理", "QuanManager"));
   
   
    tabpane.addTab("   基础信息管理   ", null, baseManagerPane, "基础信息管理");
    tabpane.addTab("   仓库信息管理   ", null, kucunManager,    "仓库信息管理");
    tabpane.addTab("   销售管理       ",null,sellManage,"销售管理");
    tabpane.addTab("   查询信息管理   ",null,chaxunManager,"查询信息管理");
    tabpane.addTab("   进货管理面板   ",null,stockManagePanel,"进货管理面板");
    tabpane.addTab("   系统管理面板   ",null,sysManagePanel,"系统管理面板");
   
   
    return tabpane;
    }
    
    private JButton createFrameButton(String fName,String cName)
    {
        String imgurl="res/ActionIcon/"+fName+".png";
        String imgurl_roll="res/ActionIcon/"+fName+"_roll.png";
        String imgurl_down="res/ActionIcon/"+fName+"_down.png";
        Icon  icon=new ImageIcon(imgurl);
        Icon icon_roll=null;
        if(imgurl_roll==null)
          icon_roll=new ImageIcon(imgurl_roll);
        Icon icon_down=null;
        if(icon_down==null)
          icon_down=new ImageIcon(imgurl_down);
        Action act=new openFrameAction(fName,cName,icon);
        JButton but=new JButton(act);
        but.setMargin(new Insets(0,0,0,0));
        but.setHideActionText(true);
        but.setFocusPainted(false);
        but.setBorderPainted(false);
        but.setContentAreaFilled(false);
        if(icon_roll!=null)
           but.setRolloverIcon(icon_roll);
        if(icon_down!=null)
           but.setRolloverIcon(icon_down);
           
        return but;
    }
    
    protected final class openFrameAction  extends AbstractAction
    {
        private String framename=null;
        private openFrameAction()
        {
        }
        public openFrameAction(String cName,String framename,Icon icon)
        {
            this.framename=framename;
            putValue(Action.NAME,cName);
            putValue(Action.SHORT_DESCRIPTION,cName);
            putValue(Action.SMALL_ICON,icon);
        }
        public void actionPerformed(final ActionEvent e)
        {
            JInternalFrame jf=getIFrame(framename);
            jf.addInternalFrameListener(new InternalFrameAdapter()
            {
                public void internalFrameClosed(InternalFrameEvent e)
                {
                    ifs.remove(framename);
                }
            });
            if(deskPane==null)
            {
                deskPane.add(jf);
                jf.setVisible(true);
            }
            try
            {
                jf.setSelected(true);
            }
            catch(Exception eee)
            {
                System.out.println("fail1");
            }
        }
        
        
    }
    private JInternalFrame getIFrame(String framename)
    {
        JInternalFrame jf=null;
        if(!ifs.containsKey(framename))
        {
            try
            {
              Class jfclass=Class.forName(framename);
              Constructor con=jfclass.getConstructor(null);
              jf=(JInternalFrame)con.newInstance(null);
              ifs.put(framename,jf);
          }
          catch(Exception eeee)
          {
              System.out.print("fail2");
          }
            
        }
        else
        {
            jf=ifs.get(framename);
        }
        return jf;
    }
    static
    {
        try
        {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }
        catch (Exception e)
         {
            System.out.println("fail3");
        }
    }
    
}
那我在点相应的按钮时弹不出内部窗体JInternalFrame

知识改变命运!!!
2008-11-29 14:00
fqj793
Rank: 1
等 级:新手上路
威 望:2
帖 子:228
专家分:0
注 册:2006-12-9
收藏
得分:0 
出错的信息就是在这个代码:
 try
            {
              Class jfclass=Class.forName(framename);
              Constructor con=jfclass.getConstructor(null);
              jf=(JInternalFrame)con.newInstance(null);
              ifs.put(framename,jf);
          }
          catch(Exception eeee)
          {
              System.out.print("fail2");
          }

知识改变命运!!!
2008-11-29 14:01
快速回复:编译出现警告信息!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.034379 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved