lookAndfeel的jar包怎么用? 下完的包应该放到哪里? 谢谢另外 直接将包加到工程里是不是在工程里建个lib就行了? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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();} } }); }} 楼上...我是在问下载的包怎么用 ....下完后放哪里? 是否需要import语句引入? 放到类路径里或者你的IDE环境lib下,只要你的project能找的到.需要import的.不必加到项目里去,如果将来打包,一般建立一个lib目录,把所引用的jar文件放进去,在manifest文件中指明classpath:lib/*.jar就行 放到jdk_home\jre\lib\ext\下(对jdk)或java_home\lib\ext\下(只有jre)这样就可以不设classpath了 一个jframe怎么刷新(或者其他操作)另一个jframe 关于while的一个小问题! 怎么在vc和c#中运行java程序? 捕获异常时,程序的运行顺序 小妹有请---全屏实现问题? 在RMI分布式系统中,应用服务器如何把客户机发出的数据库查询请求传送到数据库服务器?很急~~~~在线等 请各位高手指教小弟一个问题,有关于JAVA简单程序题!谢谢! java对话框问题请教! 高难问题!请教高手!100分。 环境配置问题,简单 用java swing开发出的---图书借阅管理信息系统 合并数组算法如何实现?
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();}
}
});
}
}
jdk_home\jre\lib\ext\下(对jdk)
或
java_home\lib\ext\下(只有jre)这样就可以不设classpath了