我想用java做非Windows的界面
比如说Linux的界面
但是又要在Windows下显示
哪位高手做过?
给点东西学习一下

解决方案 »

  1.   

    public static void main(String[] args) {
        try {
          UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }
        catch(Exception e) {
          e.printStackTrace();
        }
    }
    UIManager.getSystemLookAndFeelClassName()表示调用操作系统的界面
    此句改为"javax.swing.plaf.metal.MetalLookAndFeel"就是metal的界面
    其他界面请查询API里LookAndFeel这个类
      

  2.   

    Borland的LOF最好看
    LINUX的那个最难看....
      

  3.   

    我在Eclipse里面新建一个Frame测试HS说的,public static void main(String[] args)
    {
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
    {
    //JFrame.setDefaultLookAndFeelDecorated(true);
    try
    {
    //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    UIManager.setLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel);//添加的
    }
    catch .........
    但是报错说
    java.lang.Error: Unresolved compilation problem: 
    javax.swing.plaf.metal.MetalLookAndFeel cannot be resolved请问这是怎么回事啊????谢谢先!
      

  4.   

    UIManager.setLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel);
    ==================================================================
    UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
      

  5.   

    look and feel 包有很多开源代码
    自己去下吧
      

  6.   

    UIManager.setLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel);
    javax.swing.plaf.metal.MetalLookAndFeel这句是要加引号的,请改为
    UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");