简体   繁体   中英

JButton background and foreground color swipe when button pressed

Could any one help to implement below thing?

I have custom button which i have overloaded the paintComponent and plainText method to give my own look. the main focus of overridden is to give my own style for buttons.

so here the requirement is originally button background is white and foreground is black and when user press the button the color should revert like background as black and foreground as white.

how can i achieve this?

Instead of subclassing Swing components to modify how they «look and feel», you can provide your own UI implementation and attach it to a normal component instance.

Look at following methods:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM