Here you can find the source of reduceNimbusButtonMargin(final JButton button)
Parameter | Description |
---|---|
button | button to alter |
public static void reduceNimbusButtonMargin(final JButton button)
//package com.java2s; /*// w w w . j av a 2 s . c o m * jGnash, a personal finance application * Copyright (C) 2001-2015 Craig Cavanaugh * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import java.awt.Insets; import javax.swing.JButton; import javax.swing.UIDefaults; public class Main { /** * Reduce the margins around the content of a button for the Nimbus look and feel * * @param button button to alter */ public static void reduceNimbusButtonMargin(final JButton button) { UIDefaults buttonDefaults = new UIDefaults(); buttonDefaults.put("Button.contentMargins", new Insets(6, 6, 6, 6)); button.putClientProperty("Nimbus.Overrides", buttonDefaults); button.putClientProperty("Nimbus.Overrides.InheritDefaults", Boolean.FALSE); } }