Java setResizable(false) changes the window size (swing)

前端 未结 7 770
情深已故
情深已故 2020-12-09 17:45

I have a strange problem. I am using the null layout for a window (= JFrame and on windows) and if I use setResizable (false) the window size gets bigger (to right and botto

7条回答
  •  Happy的楠姐
    2020-12-09 18:25

    Well I have met this problem and it is a Look & Feel problem...

    Why the resizable frame has an insets of (5, 5, 5, 5)? It leads me to think that make it resizable adds some extra component around the frame, like... some kind of "handler" to drag to resize?

    And then I found that if we use default Java Metal l&f and set setDefaultLookAndFeelDecorated(true), the handler will be painted and thus, the frame will not change size. But in Nimbus, Motif and Windows L&F this point is not implemented, so it's a bug. I will report it.

    My own question and my answer with GIF is here:

    Swing - setResizable(true) make JFrame title bar higher and window size smaller

提交回复
热议问题