Here you can find the source of allignBottom(JComponent lead, JComponent target, int width, int height)
public static void allignBottom(JComponent lead, JComponent target, int width, int height)
//package com.java2s; //License from project: LGPL import java.awt.Rectangle; import javax.swing.JComponent; public class Main { public static void allignBottom(JComponent lead, JComponent target) { allignBottom(lead, target, -1, -1); }/*from w w w . ja v a 2 s . c om*/ public static void allignBottom(JComponent lead, JComponent target, int width, int height) { Rectangle rLead = lead.getBounds(); Rectangle rTarget = target.getBounds(); rTarget.x = rLead.x; rTarget.y = rLead.y + rLead.height; if (width > 0) { rTarget.width = width; } if (height > 0) { rTarget.height = height; } target.setBounds(rTarget); } }