JComponent () { JPanel result = new JPanel(new BorderLayout()); JPanel icon = new JPanel(new BorderLayout()); icon.add(myIcon, BorderLayout.NORTH); result.add(icon, BorderLayout.WEST); JPanel header = new JPanel(); header.setLayout(new BoxLayout(header, BoxLayout.Y_AXIS)); header.add(myHeader); header.add(Box.createVerticalStrut(4)); header.add(myExplanation); header.add(Box.createVerticalStrut(4)); header.add(new SeparatorComponent(0, Color.gray, null)); header.setBorder(BorderFactory.createEmptyBorder(4, 2, 4, 2)); JPanel content = new JPanel(new BorderLayout(12, 12)); content.add(header, BorderLayout.NORTH); myCardLayout = new CardLayout(); myStepContent = new JPanel(myCardLayout) { @Override public Dimension getPreferredSize() { Dimension custom = getWindowPreferredSize(); Dimension superSize = super.getPreferredSize(); if (custom != null) { custom.width = custom.width > 0 ? custom.width : superSize.width; custom.height = custom.height > 0 ? custom.height : superSize.height; } else { custom = superSize; } return custom; } }; content.add(header, BorderLayout.NORTH); content.add(myStepContent, BorderLayout.CENTER); result.add(content, BorderLayout.CENTER); //myHeader.setFont(myHeader.getFont().deriveFont(Font.BOLD, 14)); //myHeader.setFont(myHeader.getFont().deriveFont(Font.PLAIN, 12)); return result; }