Here you can find the source of copyButtonWidth(JButton toButton, JButton fromButton)
Parameter | Description |
---|---|
toButton | The button that will take on the width of another |
fromButton | The button whose width will be copied |
public static void copyButtonWidth(JButton toButton, JButton fromButton)
//package com.java2s; /*//from w ww .j a v a 2 s . co m * (C) Copyright 2009-2011 Cristian Dinu <goc9000@gmail.com> * * Licensed under the GPL-3. */ import javax.swing.JButton; public class Main { /** * Makes a button as wide as another given button. This is * useful for making sure buttons arranged in a column have the * same width. * * @param toButton The button that will take on the width of another * @param fromButton The button whose width will be copied */ public static void copyButtonWidth(JButton toButton, JButton fromButton) { toButton.setPreferredSize(fromButton.getPreferredSize()); toButton.setMaximumSize(fromButton.getMaximumSize()); } }