Java tutorial
//package com.java2s; /** * some swing helpers from * http://www.javapractices.com/topic/TopicAction.do?Id=152 * * @author Hirondelle Systems (code snippets used on BSD license) */ import java.awt.Dimension; import java.util.Iterator; import javax.swing.JComponent; public class Main { private static void setSizes(java.util.List<JComponent> aComponents, Dimension aDimension) { Iterator<JComponent> compsIter = aComponents.iterator(); while (compsIter.hasNext()) { JComponent comp = (JComponent) compsIter.next(); comp.setPreferredSize((Dimension) aDimension.clone()); comp.setMaximumSize((Dimension) aDimension.clone()); } } }