How to call setUndecorated() after a frame is made visible?

前端 未结 7 1830
醉梦人生
醉梦人生 2020-11-30 10:52

In my Swing application, I want the ability to switch between decorated and undecorated without recreating the entire frame. However, the API doesn\'t let me call setU

7条回答
  •  臣服心动
    2020-11-30 11:42

    calling dispose() releases the native window resources. then you can edit properties like undecorated and so on. then just call setVisible(true) to recreate the window resources and everything works fine (the position and all compoenents won`t be changed)

    dispose();
    setUndecorated(true/false);
    setVisible(true);
    

提交回复
热议问题