How to make a JPanel inside a JFrame fill the whole window?

后端 未结 4 455
深忆病人
深忆病人 2021-01-14 01:43

In the below example, how can I get the JPanel to take up all of the JFrame? I set the preferred size to 800x420 but it only actually fills 792x391.

import j         


        
4条回答
  •  天命终不由人
    2021-01-14 02:28

    If you want to fill the JFrame with the whole of JPanel you need to setUndecorated to true i.e. frame.setUndecorated(true);. But now you have to worry about your MAXIMIZE< MINIMIZE, and CLOSE Buttons, towards the top right side(Windows Operating System)

提交回复
热议问题