0

I am creating a program in java that has a JMenu. I am trying to edit the JMenu so that when selected the item has a different colour and border than the default swing L&F. I have managed to change the actual selection background with UIManager.put("Menu.selectionBackground") but have been unable to figure out how to change the border.

So far I have tried using an actionListener that changes the border when clicked which does not work as well as trying a potential "Menu.selectionBorder" which does not exist. So is there anyway to change the border when selected or is it not something I can do?

I have linked an image to show what I have currently

My Menubar with the first item selected which is blue as stated above.

MorganOC01
  • 29
  • 4
  • You can use a `MenuListener` and handle the `menuSelected/Deselected` events to set/reset the Border. Check out: https://stackoverflow.com/a/75403560/131872 for a simple example to get you started. – camickr Feb 20 '23 at 23:49

0 Answers0