Remove the border like so:
button.setBorder(BorderFactory.createEmptyBorder());
and then also the contents1:
button.setContentAreaFilled(false);
1: Taken from the solution added to the question by @3sdmx
More Related Contents:
- Loading resources like images while running project distributed as JAR archive
- Creating a custom button in Java with JButton
- How to get X and Y index of element inside GridLayout?
- Something seems wrong with the layout, JButton showing unexpected behaviour at resize of the window
- Java Event-Dispatching Thread explanation
- Re-paint on translucent frame/panel/component.
- How to bring a window to the front?
- How can I scroll more than one object at the same time?
- Graphics rendering in title bar
- Resizing icon to fit on JButton in Java?
- Is it safe to construct Swing/AWT widgets NOT on the Event Dispatch Thread?
- Word Wrap in JButtons
- paintComponent() vs paint() and JPanel vs Canvas in a paintbrush-type GUI
- How do I save preference user settings in Java?
- Add Jbutton to each row of a Jtable
- Why is my JLabel not showing up
- Choosing a file in-pane with Swing
- how to drag and drop files from a directory in java
- Using addMouseListener() and paintComponent() for JPanel
- Attaching A Single Action Listener To All Buttons
- How to add action listener that listens to multiple buttons
- Change JButton gradient color, but only for one button, not all
- How to add JPanel by clicking JButton?
- Using JInternalFrame and some button
- Right Clicking on JButton
- Snake game in Java but my restart button does not work
- Getting a HeadlessException: No X11 DISPLAY variable was set
- JFrame: get size without borders?
- Why is paint()/paintComponent() never called?
- How to print a JTable object in the Java application