miAsWindows,miAsMotif,miAsMetal为menuItemmiAsWindows.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent ae){
        String plaf="com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
        setWindowStyle(plaf);
        canvas.fanning();
        miAsWindows.setState(true);
        miAsMotif.setState(false);
        miAsMetal.setState(false);
    }
});
        
miAsMotif.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent ae){
        String plaf="com.sun.java.swing.plaf.motif.MotifLookAndFeel";
        setWindowStyle(plaf);
        canvas.fanning();
        miAsWindows.setState(false);
        miAsMotif.setState(true);
        miAsMetal.setState(false);
    }
});
        
miAsMetal.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent ae){
        String plaf="javax.swing.plaf.metal.MetalLookAndFeel";
        setWindowStyle(plaf);
             canvas.fanning();
             miAsWindows.setState(false);
             miAsMotif.setState(false);
             miAsMetal.setState(true);
         }
     });
 } private void setWindowStyle(String plaf){
     try{
         UIManager.setLookAndFeel(plaf);
         SwingUtilities.updateComponentTreeUI(this);
     }catch(Exception e){
     }
 }

解决方案 »

  1.   

    快把100分送给ddbean(丁大伯)吧。
      

  2.   

    canvas.fanning();是什么?给个解释啊!看不懂!
      

  3.   

    好东西
    就是 ddbean(丁大伯) 说得很好
      

  4.   

    canvas.fanning()是我自己用的时候定义的一个方法。
    这里不用,你可以删掉,其他的没有问题的
      

  5.   

    ddbean(丁大伯) :我跟你写的一样的!你看过我那几张图片吗?
    我问的不是怎么实现这个!我问的是为什么边框没换!
      

  6.   

    public static void main(String[] args){
         JDialog.setDefaultLookAndFeelDecorated (true);
            //JFrame.setDefaultLookAndFeelDecorated(true);do not use JFrame.setDefaultLookAndFeelDecorated(true);Because com.sun.java.swing.plaf.windows.WindowsLookAndFeel and com.sun.java.swing.plaf.motif.MotifLookAndFeel don't support Window Decoration. So window title and border will not show.However javax.swing.plaf.metal.MetalLookAndFeel supports Window Decoration.you can use UIManager.getLookAndFeel().getSupportsWindowDecorations() to check if current LookAndFeel supports Window Decoration.
      

  7.   

    to wobelisk() ( ):不对啊!我在初始化界面的时候就可以显示其他标题和边框的
      

  8.   

    初始 LookAndFeel supports Window Decorations, so 可以显示标题和边框.after you select 
    com.sun.java.swing.plaf.windows.WindowsLookAndFeel or com.sun.java.swing.plaf.motif.MotifLookAndFeelThey don't support Window Decoration. So window title and border will not show.Clear?
      

  9.   

    我的程序里面com.sun.java.swing.plaf.windows.WindowsLookAndFeel & com.sun.java.swing.plaf.motif.MotifLookAndFeel是都可以显示标题合边框的
      

  10.   

    to wobelisk():
    明白了!我试了下!只能显示默认的边框!
    谢谢了,100分,马上给你