我一般是用它来做java界面风格转化,比如用windows风格来显示java的GUI程序。

解决方案 »

  1.   

    同楼上的。  private void jMenuItemUI_actionPerformed(ActionEvent e)
      {
        String strUI = null;
        if(e.getSource() == jMenuItemUIMetal)
        {
          strUI = "javax.swing.plaf.metal.MetalLookAndFeel";
        }
        else if(e.getSource() == jMenuItemUIMotif)
        {
          strUI = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
        }
        else if(e.getSource() == jMenuItemUIWindows)
        {
          strUI = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
        }
        else return;
        try
        {
          UIManager.setLookAndFeel(strUI);
          SwingUtilities.updateComponentTreeUI(this);
        }
        catch(Exception e1)
        {
          e1.printStackTrace();
        }  }