How to maximize a JFrame through code?

后端 未结 5 590
天涯浪人
天涯浪人 2020-12-15 03:33

How to maximize a JFrame through code?

5条回答
  •  無奈伤痛
    2020-12-15 03:57

    Yea the Toolkit solution ignores the windows task bar and uses the full screen which is not what you want.

    For an immediate maximise of your form just add this in the JFrame constructor after the InitiateComponents() call.

    this.setExtendedState(JFrame.MAXIMIZED_BOTH);
    

    The class extends JFrame of course:

    public class MyForm extends javax.swing.JFrame
    

提交回复
热议问题