Java JComponent Width allignBottom(JComponent lead, JComponent target, int width, int height)

Here you can find the source of allignBottom(JComponent lead, JComponent target, int width, int height)

Description

allign Bottom

License

LGPL

Declaration

public static void allignBottom(JComponent lead, JComponent target, int width, int height) 

Method Source Code

//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);
    }
}

Related

  1. addComponent(Container container, JComponent component, int xPos, int yPos, int width, int height, double weightX, double weightY, int insetTop, int insetLeft, int insetBottom, int insetRight, int anchor, int stretch)
  2. adjustNarrowField(final JComponent component, final int width)
  3. adjustWidth(JComponent aComponent, int aWidth)
  4. calculateCharWidth(JComponent component, int numChars)
  5. clearWidth(JComponent comp)
  6. clipString(final JComponent component, final String string, final int avaiableWidth)
  7. clipStringifNeeded(final JComponent component, final String string, final int avaiableWidth)