Primefaces动态菜单的图标 [英] Icon for Primefaces Dynamic Menu

查看:87
本文介绍了Primefaces动态菜单的图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将图标从JSF资源文件夹获取到通过org.primefaces.model.MenuModel创建的动态菜单;菜单的setIcon方法仅将字符串作为参数.

How to get an icon from JSF resources folder to a dynamic menu created from org.primefaces.model.MenuModel; The setIcon methods of menu take only a string as a parameter.

推荐答案

是的,setIcon方法采用一个字符串,该字符串是您要设置的图标的名称.例如:

Yes, the setIcon method takes a string which is the name of the icon you want to set. So for example:

    MenuItem item3 = new MenuItem();
    item3.setIcon("ui-icon-print");

您是否正在尝试使用图像而不是图标?这里有一个预定义图标的备忘单: http://www.petefreitag.com/cheatsheets/jqueryui-icons/

Are you perhaps trying to use an image instead of an icon? There is a cheat sheet of predefined icons here: http://www.petefreitag.com/cheatsheets/jqueryui-icons/

如果您尝试创建自己的图标,则需要执行@Ravi指示的操作并创建一个自定义CSS类,您将在setIcon()方法中引用该类.

If you are trying to create your own icon then you will need to do what @Ravi has indicated and create a custom CSS class which you will reference in the setIcon() method.

这篇关于Primefaces动态菜单的图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆