1

I have created custom menu in my application, i have already set its background,border and font of the item display in the menu. But i could not able to set font color for the menu item display in menu.
How to set font color for the menu item??..
my code look like this :
I have set border,background and font as shown below :-

XYEdges edge = new XYEdges(10, 10, 10, 10);
menu_border = BorderFactory.createRoundedBorder(edge,Border.STYLE_DOTTED);
menu_back = BackgroundFactory.createSolidTransparentBackground(Color.LIGHTPINK,50);
    try 
    {
        FontFamily fnt_family = FontFamily.forName("BBCasual");
        menu_font = fnt_family.getFont(Font.PLAIN,30,Ui.UNITS_px);
    }
    catch(ClassNotFoundException e){
    }

and i override the makeMenu() function as shown:

protected void  makeMenu(Menu menu,int context) 
{
    menu.setBackground(menu_back);
    menu.setBorder(menu_border);
    menu.setFont(menu_font);
    super.makeMenu(menu, context);
}

Thanks in advance..

Yagnesh Agola
  • 4,556
  • 6
  • 37
  • 50

2 Answers2

3

There's no API to do what you want.

Mister Smith
  • 27,417
  • 21
  • 110
  • 193
-1
LabelField label0=new LabelField(" Label",LabelField.USE_ALL_WIDTH){

     public void paint(Graphics g)
     {                                   
          g.setColor(Color.RED);
          super.paint(g);
     }   
};

This code set the font color of labelfield to red use it for menu and change the color as u want

Nate
  • 31,017
  • 13
  • 83
  • 207
Shaikh Azhar Alam
  • 173
  • 1
  • 3
  • 16