Buggy code:
public class MainFrame extends JFrame { private JPanel _currentPanel ; public MainFrame ( ) { } @ SuppressWarnings ( "unchecked" ) private void initComponents ( ) { MasterPanel = new JPanel ( ) ; pnlLanding = new JPanel ( ) ; btnCreate = new JButton ( ) ; btnFind = new JButton ( ) ; btnHotel = new JButton ( ) ; Quit = new JButton ( ) ; createMainPanel1 = new planningformen . ui . gui . CreateMainPanel ( ) ; findMainPanel2 = new planningformen . ui . gui . FindMainPanel ( ) ; tyreHotelPanel1 = new planningformen . ui . gui . TyreHotelPanel ( ) ; btnBack = new JButton ( ) ; setDefaultCloseOperation ( WindowConstants . EXIT_ON_CLOSE ) ; setPreferredSize ( new Dimension ( 1280 , 720 ) ) ; MasterPanel . setLayout ( new CardLayout ( ) ) ; btnCreate . setText ( "Create" ) ; btnCreate . addActionListener ( new ActionListener ( ) { public void actionPerformed ( ActionEvent evt ) { btnCreateActionPerformed ( evt ) ; } } ) ; btnFind . setText ( "Find" ) ; btnFind . addActionListener ( new ActionListener ( ) { public void actionPerformed ( ActionEvent evt ) { btnFindActionPerformed ( evt ) ; } } ) ; btnHotel . setText ( "TyreHotel" ) ; btnHotel . addActionListener ( new ActionListener ( ) { public void actionPerformed ( ActionEvent evt ) { btnHotelActionPerformed ( evt ) ; } } ) ; Quit . setText ( "Quit" ) ; Quit . addActionListener ( new ActionListener ( ) { public void actionPerformed ( ActionEvent evt ) { QuitActionPerformed ( evt ) ; } } ) ; GroupLayout pnlLandingLayout = new GroupLayout ( pnlLanding ) ; pnlLanding . setLayout ( pnlLandingLayout ) ; pnlLandingLayout . setHorizontalGroup ( pnlLandingLayout . createParallelGroup ( GroupLayout . Alignment . LEADING ) . addGroup ( pnlLandingLayout . createSequentialGroup ( ) . addGap ( 383 , 383 , 383 ) . addGroup ( pnlLandingLayout . createParallelGroup ( GroupLayout . Alignment . LEADING ) . addComponent ( Quit , GroupLayout . PREFERRED_SIZE , 163 , GroupLayout . PREFERRED_SIZE ) . addComponent ( btnCreate , GroupLayout . PREFERRED_SIZE , 163 , GroupLayout . PREFERRED_SIZE ) . addComponent ( btnFind , GroupLayout . PREFERRED_SIZE , 163 , GroupLayout . PREFERRED_SIZE ) . addComponent ( btnHotel , GroupLayout . PREFERRED_SIZE , 163 , GroupLayout . PREFERRED_SIZE ) ) . addContainerGap ( 741 , Short . MAX_VALUE ) ) ) ; pnlLandingLayout . setVerticalGroup ( pnlLandingLayout . createParallelGroup ( GroupLayout . Alignment . LEADING ) . addGroup ( pnlLandingLayout . createSequentialGroup ( ) . addGap ( 162 , 162 , 162 ) . addComponent ( btnCreate , GroupLayout . PREFERRED_SIZE , 46 , GroupLayout . PREFERRED_SIZE ) . addPreferredGap ( LayoutStyle . ComponentPlacement . UNRELATED ) . addComponent ( btnFind , GroupLayout . PREFERRED_SIZE , 46 , GroupLayout . PREFERRED_SIZE ) . addPreferredGap ( LayoutStyle . ComponentPlacement . UNRELATED ) . addComponent ( btnHotel , GroupLayout . PREFERRED_SIZE , 46 , GroupLayout . PREFERRED_SIZE ) . addPreferredGap ( LayoutStyle . ComponentPlacement . UNRELATED ) . addComponent ( Quit , GroupLayout . PREFERRED_SIZE , 46 , GroupLayout . PREFERRED_SIZE ) . addContainerGap ( 568 , Short . MAX_VALUE ) ) ) ; MasterPanel . add ( pnlLanding , "card2" ) ; MasterPanel . add ( createMainPanel1 , "card3" ) ; MasterPanel . add ( findMainPanel2 , "card4" ) ; MasterPanel . add ( tyreHotelPanel1 , "card5" ) ; btnBack . setText ( "Back" ) ; btnBack . addActionListener ( new ActionListener ( ) { public void actionPerformed ( ActionEvent evt ) { btnBackActionPerformed ( evt ) ; } } ) ; GroupLayout layout = new GroupLayout ( getContentPane ( ) ) ; getContentPane ( ) . setLayout ( layout ) ; layout . setHorizontalGroup ( layout . createParallelGroup ( GroupLayout . Alignment . LEADING ) . addComponent ( MasterPanel , GroupLayout . PREFERRED_SIZE , GroupLayout . DEFAULT_SIZE , GroupLayout . PREFERRED_SIZE ) . addGroup ( layout . createSequentialGroup ( ) . addGap ( 439 , 439 , 439 ) . addComponent ( btnBack , GroupLayout . PREFERRED_SIZE , 105 , GroupLayout . PREFERRED_SIZE ) ) ) ; <START_BUG> layout . setVerticalGroup ( layout . createParallelGroup ( GroupLayout . Alignment . LEADING ) . addGroup ( layout . createSequentialGroup ( ) . addComponent ( MasterPanel , GroupLayout . PREFERRED_SIZE , 947 , GroupLayout . PREFERRED_SIZE ) . addPreferredGap ( LayoutStyle . ComponentPlacement . UNRELATED ) . addComponent ( btnBack ) . addContainerGap ( 36 , Short . MAX_VALUE ) ) ) ; <END_BUG> pack ( ) ; } private void btnCreateActionPerformed ( ActionEvent evt ) { } private void QuitActionPerformed ( ActionEvent evt ) { } private void btnBackActionPerformed ( ActionEvent evt ) { } private void btnFindActionPerformed ( ActionEvent evt ) { } private void btnHotelActionPerformed ( ActionEvent evt ) { } public static void main ( String [ ] args ) { } private void changePanel ( JPanel newPanel ) { } private JPanel MasterPanel ; private JButton Quit ; private JButton btnBack ; private JButton btnCreate ; private JButton btnFind ; private JButton btnHotel ; private CreateMainPanel createMainPanel1 ; private FindMainPanel findMainPanel2 ; private JPanel pnlLanding ; private TyreHotelPanel tyreHotelPanel1 ; }

Fix:
layout . setVerticalGroup ( layout . createParallelGroup ( GroupLayout . Alignment . LEADING ) . addGroup ( layout . createSequentialGroup ( ) . addComponent ( MasterPanel , GroupLayout . PREFERRED_SIZE , 947 , GroupLayout . PREFERRED_SIZE ) . addPreferredGap ( LayoutStyle . ComponentPlacement . UNRELATED ) . addComponent ( btnBack ) . addContainerGap ( 606 , Short . MAX_VALUE ) ) ) ;