blackberry中的自定义菜单-更改菜单项的字体颜色
我已经在我的应用程序中创建了blackberry中的自定义菜单-更改菜单项的字体颜色,blackberry,menuitem,blackberry-eclipse-plugin,Blackberry,Menuitem,Blackberry Eclipse Plugin,我已经在我的应用程序中创建了自定义菜单,我已经在菜单中设置了项目显示的背景、边框和字体。但是我无法为菜单中的菜单项显示设置字体颜色。 如何设置菜单项的字体颜色???。 我的代码如下所示: 我已设置边框、背景和字体,如下所示:- XYEdges edge = new XYEdges(10, 10, 10, 10); menu_border = BorderFactory.createRoundedBorder(edge,Border.STYLE_DOTTED); menu_back = Backg
自定义菜单
,我已经在菜单中设置了项目显示的背景、边框和字体。但是我无法为菜单中的菜单项显示设置字体颜色。
如何设置菜单项的字体颜色???。
我的代码如下所示:
我已设置边框、背景和字体,如下所示:-
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){
}
我重写makeMenu()函数,如图所示:
protected void makeMenu(Menu menu,int context)
{
menu.setBackground(menu_back);
menu.setBorder(menu_border);
menu.setFont(menu_font);
super.makeMenu(menu, context);
}
提前感谢。没有API可以实现您想要的功能
LabelField label0=new LabelField(" Label",LabelField.USE_ALL_WIDTH){
public void paint(Graphics g)
{
g.setColor(Color.RED);
super.paint(g);
}
};
此代码将labelfield的字体颜色设置为红色。将其用于菜单,并根据需要更改颜色。是否有其他方法可以执行此操作?此代码既不能用于菜单
也不能用于菜单项
。