to create your own (user defined/customized) ui-icon in jsf primefaces follow these steps:
- My image name is "pencilfour.png", put it inside resources folder in webapp.
Define your own icon with a new name
inside "style" tag in your xhtml page:
.uipencil-icon {
width: 16px;
height: 16px;
align:up;
background-image: url(#{resource['img:pencilfour.png']})!important ;
}
you can modify with and height as per your requirement.
- Then you can use the defined icon with the command button
<p:commandButton
icon="uipencil-icon"
style=" vertical-align:middle;
margin-right:10px;
height:19px;
width:19px;"
</p:commandButton>
this will work, the only thing to take care about is providing the correct url: url(#{resource['img:pencilfour.png']})!important ;
the syntax for url is imp to fetch the image on the command button :)