Java JComponent Width setComponent3Width(JComponent c, int width)

Here you can find the source of setComponent3Width(JComponent c, int width)

Description

set Component Width

License

Open Source License

Declaration

public static void setComponent3Width(JComponent c, int width) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.Dimension;

import javax.swing.JComponent;

public class Main {
    public static void setComponent3Width(JComponent c, int width) {
        Dimension d = new Dimension(width, c.getPreferredSize().height);
        set3Dimensions(c, d);//from  ww  w .j a  v  a2 s .c om
    }

    public static void set3Dimensions(JComponent c, Dimension d) {
        c.setMinimumSize(d);
        c.setPreferredSize(d);
        c.setMaximumSize(d);
    }
}

Related

  1. makeEqualWidth(JComponent... components)
  2. makeSamePreferredWidth(JComponent... comps)
  3. normalizeWidth(JComponent... components)
  4. sameWidth(JComponent[] components, int width)
  5. setBoundsAndCenterHorizontally(JComponent component, int x, int y, int width, int height)
  6. setComponentWidth(final JComponent component, final int width)
  7. setMaximumWidth(final JComponent component, final int width)
  8. setMaximumWidth(JComponent component, int width)
  9. setMaxWidth(JComponent comp, int width)