我做的java application很丑  听说可以用swing的外观插件改变外观  好象是说JFC什么的  我没什么
概念  谁能跟我具体讲讲啊。还有 哪有好的外观插件下载?  下载后具体怎么操作?我用的是eclipse
的IDE。  问题又大又菜   还请多多指教  谢谢拉

解决方案 »

  1.   

    try
    {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch (ClassNotFoundException cnfe)
    {
    System.err.println("initLookAndFeel(): " + cnfe); }
      

  2.   

    public static void main(String[] args) {
           try
    {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch (ClassNotFoundException cnfe)
    {
    System.err.println("initLookAndFeel(): " + cnfe);
             }
    }
      

  3.   

    看不太懂 能帮忙加点注释解释下吗?  还有那个LookAndFeel在哪能弄到啊?
      

  4.   

    那是直接获得系统的外观,你这样写后他就把你程序里所有组件什么的全按你现在的操作系统(比如WINDOWS)的风格化了
      

  5.   

    http://www.jgoodies.com/
    老大,用这个吧,我也是新学,这个不错
      

  6.   

    下载了以后有帮助,还有demo程序
      

  7.   

    我也遇到这个问题了,你看下我的代码
    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);  
      }