Sets the contentAreaFilled property. If true the button will paint the content area. If you wish to have a transparent button, such as an icon only button, for example, then you should set this to false. Do not call setOpaque(false). The default value for the the contentAreaFilled property is true. This function may cause the component's opaque property to change.The exact behavior of calling this function varies on a component-by-component and L&F-by-L&F basis.
jbutton.setContentAreaFilled(false);不然就得自己绘制了。
This function may cause the component's opaque property to change.The exact behavior of calling this function varies on a component-by-component and L&F-by-L&F basis.
方法。
你还需要重写 从 JComponent 继承的contains(int,int)