下完的包应该放到哪里?    谢谢
另外    直接将包加到工程里是不是在工程里建个lib就行了?

解决方案 »

  1.   

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;public class PlafTest
    {
    public static void main(String[] args)
    {
    PlafTestJFrame frame=new PlafTestJFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.show();
    }
    }
    class PlafTestJFrame extends JFrame
    {
    public PlafTestJFrame()
    {
    Toolkit kit=Toolkit.getDefaultToolkit();
    Dimension size=kit.getScreenSize();
    int width=size.width;
    int height=size.height;

    setSize(width/2,height/2);
    setLocation(width/4,height/4);

    PlafTestJPanel panel=new PlafTestJPanel();
    Container con=getContentPane();
    con.add(panel);
    }
    }class PlafTestJPanel extends JPanel
    {
    public PlafTestJPanel()
    {
    makeButton("Metal","javax.swing.plaf.metal.MetalLookAndFeel");
    makeButton("Motif","com.sun.java.swing.plaf.motif.MotifLookAndFeel");
    makeButton("Windows","com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    }
    public void makeButton(String name,final String plafName)
    {
    JButton button=new JButton(name);
    add(button);
    button.addActionListener(new ActionListener()
    {
    public void actionPerformed(ActionEvent a)
    {
       try
       {
       UIManager.setLookAndFeel(plafName);
         SwingUtilities.updateComponentTreeUIPlafTestJPanel.this);
        }
    catch(Exception e){e.printStackTrace();}
    }
    });
    }
    }
      

  2.   

    楼上...我是在问下载的包怎么用 ....下完后放哪里?   是否需要import语句引入?
      

  3.   

    放到类路径里或者你的IDE环境lib下,只要你的project能找的到.需要import的.不必加到项目里去,如果将来打包,一般建立一个lib目录,把所引用的jar文件放进去,在manifest文件中指明classpath:lib/*.jar就行
      

  4.   

    放到
    jdk_home\jre\lib\ext\下(对jdk)

    java_home\lib\ext\下(只有jre)这样就可以不设classpath了