The easiest approach is to use setPressedIcon()
, but you can also override paint()
in the ButtonUI
delegate, as shown in this example.
More Related Contents:
- Mouse event handling in Swing
- Creating a custom button in Java with JButton
- Something seems wrong with the layout, JButton showing unexpected behaviour at resize of the window
- How do you add an ActionListener onto a JButton in Java
- How to add a shortcut key for a jbutton in java? [closed]
- How do I add an image to a JButton
- Adding image to Jbutton with foreground label
- How to change a JButton color on mouse pressed?
- Resizing icon to fit on JButton in Java?
- Word Wrap in JButtons
- How do I save preference user settings in Java?
- Can’t a Swing component be added to multiple containers?
- Add Jbutton to each row of a Jtable
- Creating a custom JButton in Java
- JButton() only working when mouse hovers
- Why is my JLabel not showing up
- resizing a ImageIcon in a JButton
- 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
- JOptionPane Passing Custom Buttons
- .setBounds not working for JLabel and JButton
- Java/Swing: low-profile button height?
- How to add JPanel by clicking JButton?
- Using JInternalFrame and some button
- Java: using an image as a button
- Return the index of clicked button?
- How to delete a row from jtable
- Making a JButton clickable inside a JTable
- Pass variables to ActionListener in Java