I used the set location relative method to set the jframe to the center still appearing to the up left of the screen here is the code :     enter code here



   `

public static void main(String args[]) {
                  

        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                try { 
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                new megui().setVisible(true);
                new megui().setLocationRelativeTo(null);
                } catch (Exception e) {
    e.printStackTrace();
    
}`enter code here`
            }
        });
    }