Java Swing GUI Main Class

Make the controller class code be this:
package CONTROLLER_PACKAGE;

import views.FRAME_CLASS;

public class CONTROLLER_CLASS {

  private final FRAME_CLASS frame = new FRAME_CLASS();
  
  public CONTROLLER_CLASS() {
    frame.setTitle( getClass().getSimpleName() );
    frame.setLocationRelativeTo(null);
    // you can adjust the size with something like this:
    // frame.setSize(600, 500);
	
    // event handlers
  }

  public static void main(String[] args) {
    CONTROLLER_CLASS app = new CONTROLLER_CLASS();
    app.frame.setVisible(true);
  }
}
select


© Robert M. Kline