I am designing a GUI using Eclipse on Mac, and I want to make the JButton to display only the Icon I set. It looks fine on Mac OS, but when I export it to a jar file, and rut in on Windows OS, the JButton looks like this:

The borders are all EmptyBorder.
What did I do wrong? How can I make the square at the back go away?
To answer this question correctly, an SSCCE will most likely be required. Anyway, I believe that you’ll want to invoke
setContentAreaFilled(false)on yourJButtoninstances. That should effectively remove the “square”.However, it is important to note that the exact behavior of calling this function varies on a component-by-component and L&F-by-L&F basis.