Sunday 15 May 2011

java - Change background and text color of JMenuBar and JMenu objects inside it -


How do I change the color of the custom background for JMenuBar and JMenu items Can I set it inside? I tried to do .setBackgroundColor and it does not work!

create a new category which extends JMenuBar :

  Public square background menu bar JMenuBar {color bgColor = Color.WHITE; Public Zero Set Color (Color Color) {BG Color = Color; } @ Override Protected Zero Paint Comonant (Graphics G) {SuperPaintConant (G); Graphics 2DG2D = (Graphics 2D) G; G2d.setColor (bgcolor); G2d.fillRect (0, 0, getWidth () - 1, getHeight () - 1); }}   

Now use this class instead of JMenuBar and set the background code to setColor () .

No comments:

Post a Comment