Here you can find the source of makeButtonFlat(AbstractButton button)
public static void makeButtonFlat(AbstractButton button)
//package com.java2s; import javax.swing.AbstractButton; import javax.swing.JToggleButton; import javax.swing.UIDefaults; import javax.swing.UIManager; import javax.swing.plaf.basic.BasicBorders; import javax.swing.plaf.basic.BasicButtonUI; import javax.swing.plaf.basic.BasicToggleButtonUI; public class Main { public static void makeButtonFlat(AbstractButton button) { // Override the default look and feel: use basic L&F because some L&F (esp. WinXP) // ignores the border property if (button instanceof JToggleButton) { button.setUI(new BasicToggleButtonUI()); } else {/* w w w. ja v a 2 s. c om*/ button.setUI(new BasicButtonUI()); } button.setRolloverEnabled(true); UIDefaults table = UIManager.getLookAndFeelDefaults(); button.setBorder(new BasicBorders.RolloverButtonBorder(table.getColor("controlShadow"), //$NON-NLS-1$ table.getColor("controlDkShadow"), //$NON-NLS-1$ table.getColor("controlHighlight"), //$NON-NLS-1$ table.getColor("controlLtHighlight"))); //$NON-NLS-1$ } }