Swing JToolbarButton pressing
问题 I use JToolbarButton button, I want to make it be "pressed" when I click on it, just like JButton works.How can I do this? Please help!Thanks. 回答1: As mentioned in Costis' reply, you are probably after a JToggleButton. It might also be necessary to suppress the painting of the border, as in the 2nd tool bar in this example. import java.awt.*; import java.awt.image.*; import javax.swing.*; class ToggleBar { public static JToggleButton getButton( Image selected, Image unselected, boolean