Here you can find the source of sameHeight(JComponent[] components, int height)
public static void sameHeight(JComponent[] components, int height)
//package com.java2s; import java.awt.Dimension; import java.util.List; import javax.swing.JComponent; public class Main { public static void sameHeight(JComponent[] components, int height) { for (int i = 0; i < components.length; i++) { Dimension size = components[i].getSize(); size.height = height;/* w ww. j ava 2 s .c om*/ components[i].setSize(size); } } public static void setSize(Dimension size, JComponent[] components) { for (JComponent component : components) { component.setSize(size); } } public static void setSize(Dimension size, List<JComponent> components) { for (JComponent component : components) { component.setSize(size); } } }