Java JComponent Size setFixedSize(JComponent component, Dimension size)

Here you can find the source of setFixedSize(JComponent component, Dimension size)

Description

set Fixed Size

License

Open Source License

Declaration

public static void setFixedSize(JComponent component, Dimension size) 

Method Source Code

//package com.java2s;
/**/*from ww w. ja  va 2 s.c om*/
 * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://robocode.sourceforge.net/license/epl-v10.html
 */

import javax.swing.*;
import java.awt.*;

public class Main {
    public static void setFixedSize(JComponent component, Dimension size) {
        component.setPreferredSize(size);
        component.setMinimumSize(size);
        component.setMaximumSize(size);
    }
}

Related

  1. saveComponentSize(JComponent comp, Preferences prefs, String name)
  2. setAllSizes(JComponent component, int width, int height)
  3. setComponentSize(int width, int height, JComponent l)
  4. setComponentSize(JComponent comp, int defWidth, int defHeight, Preferences prefs, String name)
  5. setComponentSize(JComponent comp, int width, int height)
  6. setFixedSize(JComponent component, Dimension size)
  7. setFixedSize(JComponent component, int width, int height)
  8. setMaximumSize(Dimension d, JComponent... components)
  9. setMaximumSize(Dimension maxComponentSize, JComponent component)