Here you can find the source of initComponentHeight(final Component... components)
public static void initComponentHeight(final Component... components)
//package com.java2s; import java.awt.Component; import java.awt.Dimension; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.plaf.metal.MetalLookAndFeel; public class Main { static final String LAF_METAL = MetalLookAndFeel.class.getName(); public static void initComponentHeight(final Component... components) { if (components == null) { return; }/*from w ww. j a v a 2 s .c om*/ for (final Component component : components) { if ((component instanceof JComboBox) || (component instanceof JButton)) { component.setPreferredSize(new Dimension(component.getPreferredSize().width, 22)); } else if (component instanceof JTextField) { final String lf = UIManager.getLookAndFeel().getClass().getName(); int i = 22; if (lf.equals(LAF_METAL)) { i = 23; } component.setPreferredSize(new Dimension(component.getPreferredSize().width, i)); } } } }