public static void showMaximized(Frame frame){
  frame.pack();
  frame.setExtendedState(Frame.MAXIMIZED_BOTH);
  frame.setVisible(true);
  frame.toFront();
}

public static void showMaximized ( Frame frame ) { frame . pack ( ) ; frame . setExtendedState ( Frame . MAXIMIZED_BOTH ) ; frame . setVisible ( true ) ; frame . toFront ( ) ; }
show frame as maximized .
