Here you can find the source of setFixedSize(JComponent component, Dimension size)
public static void setFixedSize(JComponent component, Dimension size)
//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); } }