Java JComponent Width setMaxWidth(JComponent comp, int width)

Here you can find the source of setMaxWidth(JComponent comp, int width)

Description

set Max Width

License

Open Source License

Declaration

public static void setMaxWidth(JComponent comp, int width) 

Method Source Code

//package com.java2s;
/*/* w  w w . j  a  v  a 2 s .  c  o m*/
 Storybook: Scene-based software for novelists and authors.
 Copyright (C) 2008 - 2012 Martin Mustun
    
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
    
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
    
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.awt.Dimension;

import javax.swing.JComponent;

public class Main {
    public static void setMaxWidth(JComponent comp, int width) {
        comp.setMaximumSize(new Dimension(width, Short.MAX_VALUE));
    }
}

Related

  1. setBoundsAndCenterHorizontally(JComponent component, int x, int y, int width, int height)
  2. setComponent3Width(JComponent c, int width)
  3. setComponentWidth(final JComponent component, final int width)
  4. setMaximumWidth(final JComponent component, final int width)
  5. setMaximumWidth(JComponent component, int width)
  6. setMinimumWidth(JComponent component, int minWidth)
  7. setMinimumWidth(JComponent component, int width)
  8. setPreferredWidth(final JComponent component, final int width)
  9. setPreferredWidth(final JComponent component, final int width)