关于swing外观插件的问题~~~ 我做的java application很丑 听说可以用swing的外观插件改变外观 好象是说JFC什么的 我没什么概念 谁能跟我具体讲讲啊。还有 哪有好的外观插件下载? 下载后具体怎么操作?我用的是eclipse的IDE。 问题又大又菜 还请多多指教 谢谢拉 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException cnfe) { System.err.println("initLookAndFeel(): " + cnfe); } public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException cnfe) { System.err.println("initLookAndFeel(): " + cnfe); }} 看不太懂 能帮忙加点注释解释下吗? 还有那个LookAndFeel在哪能弄到啊? 那是直接获得系统的外观,你这样写后他就把你程序里所有组件什么的全按你现在的操作系统(比如WINDOWS)的风格化了 http://www.jgoodies.com/老大,用这个吧,我也是新学,这个不错 下载了以后有帮助,还有demo程序 我也遇到这个问题了,你看下我的代码import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.net.*;import javax.swing.*; import ccpsic.pre_test7;public class TestSQL{ public static void main(String argv[]) { final JFrame frame = new JFrame( "只能运行一个 "); try { UIManager .setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");// Nimbus风格,新出来的外观,jdk6 } catch (Exception e) { e.printStackTrace(); } frame.setBounds(100,100,200,200); JButton jb1=new JButton("当前系统风格"); jb1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {// TODO Auto-generated method stubframe.dispose();frame.setBounds(200,200,300,300);//frame.setVisible(true); try {UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());// 当前系统风格//frame.dispose();frame.repaint();frame.setVisible(true);} catch (Exception e_myUIManager) {e_myUIManager.printStackTrace();}}}); JButton jb2=new JButton("Motif风格"); jb2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {// TODO Auto-generated method stubframe.dispose();frame.setBounds(200,200,300,300);//frame.setVisible(true); try {UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");// Motif风格,外观接近windows经典,但宽宽大大,而且不是黑灰主色,而是蓝黑//frame.dispose();frame.repaint();frame.setVisible(true);} catch (Exception e_myUIManager) {e_myUIManager.printStackTrace();}}}); JButton jb3=new JButton("windows风格"); jb3.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {// TODO Auto-generated method stubframe.dispose();frame.setBounds(200,200,300,300);//frame.setVisible(true); try {UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");// windows风格// update10版本以后的才会出现//frame.dispose();frame.repaint();frame.setVisible(true);} catch (Exception e_myUIManager) {e_myUIManager.printStackTrace();}}}); JButton jb4=new JButton("java风格"); jb4.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {// TODO Auto-generated method stubframe.dispose();frame.setBounds(200,200,300,300);//frame.setVisible(true); try {UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");// java风格// update10版本以后的才会出现//frame.dispose();frame.repaint();frame.setVisible(true);} catch (Exception e_myUIManager) {e_myUIManager.printStackTrace();}}}); JPanel panel1=new JPanel(); panel1.add(jb1); panel1.add(jb2); panel1.add(jb3); panel1.add(jb4); frame.add(panel1); frame.setVisible(true); } } 连动菜单怎么实现?? java操作Excel的相关问题! update date类型的数据之后抛出如下异常,请问我犯了什么错?? sun提供的资源下载 日历控件问题紧急求助!!!!! 怎样在JTable中隐藏一列 为什么可以调用Connection的方法? 不懂兵法的皇帝和不会打仗的将军 急切寻找ibm visualage java 我想做动态网站,请问用ASP还是用Java Script,两者主要区别是什么?谢谢 什么是hashcode? Math.ceil,Math.round,Math.floor 都分别代表什么意思?
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (ClassNotFoundException cnfe)
{
System.err.println("initLookAndFeel(): " + cnfe); }
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (ClassNotFoundException cnfe)
{
System.err.println("initLookAndFeel(): " + cnfe);
}
}
老大,用这个吧,我也是新学,这个不错
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.*;import javax.swing.*; import ccpsic.pre_test7;public class TestSQL{
public static void main(String argv[])
{
final JFrame frame = new JFrame( "只能运行一个 ");
try { UIManager
.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");// Nimbus风格,新出来的外观,jdk6
} catch (Exception e) {
e.printStackTrace();
}
frame.setBounds(100,100,200,200);
JButton jb1=new JButton("当前系统风格");
jb1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
frame.dispose();
frame.setBounds(200,200,300,300);
//frame.setVisible(true);
try {
UIManager
.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());// 当前系统风格
//frame.dispose();
frame.repaint();
frame.setVisible(true);
} catch (Exception e_myUIManager) {
e_myUIManager.printStackTrace();
}
}
});
JButton jb2=new JButton("Motif风格");
jb2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
frame.dispose();
frame.setBounds(200,200,300,300);
//frame.setVisible(true);
try {
UIManager
.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");// Motif风格,外观接近windows经典,但宽宽大大,而且不是黑灰主色,而是蓝黑
//frame.dispose();
frame.repaint();
frame.setVisible(true);
} catch (Exception e_myUIManager) {
e_myUIManager.printStackTrace();
}
}
});
JButton jb3=new JButton("windows风格");
jb3.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
frame.dispose();
frame.setBounds(200,200,300,300);
//frame.setVisible(true);
try {
UIManager
.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");// windows风格
// update10版本以后的才会出现
//frame.dispose();
frame.repaint();
frame.setVisible(true);
} catch (Exception e_myUIManager) {
e_myUIManager.printStackTrace();
}
}
});
JButton jb4=new JButton("java风格");
jb4.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
frame.dispose();
frame.setBounds(200,200,300,300);
//frame.setVisible(true);
try {
UIManager
.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");// java风格
// update10版本以后的才会出现
//frame.dispose();
frame.repaint();
frame.setVisible(true);
} catch (Exception e_myUIManager) {
e_myUIManager.printStackTrace();
}
}
});
JPanel panel1=new JPanel();
panel1.add(jb1);
panel1.add(jb2);
panel1.add(jb3);
panel1.add(jb4);
frame.add(panel1);
frame.setVisible(true);
}
}