Java JComponent Size setSize(JComponent c, int w)

Here you can find the source of setSize(JComponent c, int w)

Description

set Size

License

Apache License

Declaration

private static void setSize(JComponent c, int w) 

Method Source Code

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

import java.awt.Dimension;

import javax.swing.JComponent;

public class Main {
    private static void setSize(JComponent c, int w) {
        Dimension d = new Dimension(w, c.getPreferredSize().height);
        c.setMinimumSize(d);/*  www  .  j  a  v  a 2  s.  c o  m*/
        c.setPreferredSize(d);
        c.setMaximumSize(d);
    }
}

Related

  1. setMaxPreferredSize(JComponent comp)
  2. setMinimumSize(JComponent component, int numChars)
  3. setPreferredSize(JComponent comp, int height, int width)
  4. setSize(Dimension size, JComponent[] components)
  5. setSize(final Component component, final int width, final int height)
  6. setSize(JComponent comp, int w, int h)
  7. setSize(JComponent componenet, Dimension dimension)
  8. setSize(JComponent componenet, Dimension dimension)
  9. setSize(JComponent component, int width, int height)