code: private void setupComponents() {
  		cancelButton.addActionListener(new ActionListener() {
  			@Override
  			public void actionPerformed(ActionEvent e) {
  				dispose();
  			}
  		});
  
  		finishButton.addActionListener(new ActionListener() {
  			@Override
  			public void actionPerformed(ActionEvent e) {
  				JOptionPane.showMessageDialog(getContentPane(), "Wizard finished!");
  				dispose();
  			}
  		});
  
  		cancelButton.setMnemonic(KeyEvent.VK_C);
  		previousButton.setMnemonic(KeyEvent.VK_P);
  		nextButton.setMnemonic(KeyEvent.VK_N);
  		finishButton.setMnemonic(KeyEvent.VK_F);
  
  		wizardPageContainer.addContainerListener(new MinimumSizeAdjuster());
  	}
docs: Sets up the components of the wizard with listeners and mnemonics.