Java JComponent Width sameWidth(JComponent[] components, int width)

Here you can find the source of sameWidth(JComponent[] components, int width)

Description

same Width

License

Open Source License

Declaration

public static void sameWidth(JComponent[] components, int width) 

Method Source Code

//package com.java2s;

import java.awt.Dimension;

import java.util.List;

import javax.swing.JComponent;

public class Main {
    public static void sameWidth(JComponent[] components, int width) {
        for (int i = 0; i < components.length; i++) {
            Dimension size = components[i].getSize();
            size.width = width;/*from  w w w  . java  2s.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);
        }
    }
}

Related

  1. getRectangle(JComponent comp)
  2. initComponent(JComponent component, String title, int width, int height)
  3. makeEqualWidth(JComponent... components)
  4. makeSamePreferredWidth(JComponent... comps)
  5. normalizeWidth(JComponent... components)
  6. setBoundsAndCenterHorizontally(JComponent component, int x, int y, int width, int height)
  7. setComponent3Width(JComponent c, int width)
  8. setComponentWidth(final JComponent component, final int width)
  9. setMaximumWidth(final JComponent component, final int width)