Java JComponent Width setMaximumWidth(final JComponent component, final int width)

Here you can find the source of setMaximumWidth(final JComponent component, final int width)

Description

set Maximum Width

License

Apache License

Declaration

static void setMaximumWidth(final JComponent component, final int width) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.Dimension;

import javax.swing.JComponent;

public class Main {
    static void setMaximumWidth(final JComponent component, final int width) {
        final Dimension preferredSize = component.getPreferredSize();
        final Dimension size = new Dimension(width, preferredSize.height);
        component.setMaximumSize(size);//from   ww  w.j a  va 2  s . co  m
    }
}

Related

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