how to make frame undecorated after jTattoo theme

2019-02-19 17:36发布

after using jTattoo LookAndFeel,

try {
       UIManager.setLookAndFeel(new McWinLookAndFeel());
       new Main(new UserModel()).setVisible(true);

     } catch (UnsupportedLookAndFeelException ex) {
       Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,ex); 
     }
}

i still want to make all the frames undecorated.i tried to use

this.undecorated(true);

in constructor of my frame but these codes won't work since the look and feel overrides these codes, can anyone tell me how to go above this?? any help would be much appriciated.

1条回答
迷人小祖宗
2楼-- · 2019-02-19 17:44

I had the same problem and because this API is not enough documented it may be difficult to figure out how to solve this.

The problem comes because the theme overides the standard application bar so the theme has to hide it too. I spent few minutes looking through classes code and I found out this solution. After you set the look and feel if you want to go in fullscreen mode, first you have to remove the border. So before setting:

this.undecorated(true);

remove the borders:

DecorationHelper.decorateWindows(false);

P.S before leaving fullscreen you have to redecorate the window:

DecorationHelper.decorateWindows(true);

It worked for me!

查看更多
登录 后发表回答