Java JComponent Height fixHeight(JComponent c, int height)

Here you can find the source of fixHeight(JComponent c, int height)

Description

fix Height

License

Apache License

Declaration

public static void fixHeight(JComponent c, int height) 

Method Source Code


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

import javax.swing.*;

import java.awt.*;

public class Main {
    public static void fixHeight(JComponent c, int height) {
        Dimension ps = c.getPreferredSize();
        c.setPreferredSize(new Dimension(ps.width, height));
        c.setMinimumSize(c.getPreferredSize());
        c.setMaximumSize(c.getPreferredSize());
    }//w ww  .  ja v  a2s  .  co m
}

Related

  1. adjustHeight(JComponent comp, int height)
  2. getComponentHeight(JComponent component)
  3. getMinimumHeight(JComponent comp)
  4. heighten(JComponent component, int px)
  5. makeEqualHeight(JComponent reference, JComponent... others)