In this post which has the source file attached also you can see that how you can use af:message in order to show errors that is specific to that a component.
as you know when you generate a general error like the below one
String msg="this is a global message.";the generated error would be catch by af:messages and can be shown inline or popup.
FacesContext ctx = getFacesContext();
FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, "");
but if you want your message be shown separately for different component or part of the page you can use af:message
the af:message has the property for="" which you must assign a component id to it, then this af:message would only shows the message that is related to that component, you mainly have one af:messages in your page to catch all the messages that are not related to any component and also you can have many af:message for different part of your page.
in order to generate a message that is related to a specific component in your page you must use below code
"Specific Error", "this error is just for panel box 1"));
panelBox.getClientId(getFacesContext() --> is the id of the component, you can write the id component instead but using the getClientId is error free and standard.
you can see a sample application developed in 220.127.116.11 in the attachment to this post.