查看我的代码
theme.xhtml
<h:form>
<h:panelGrid>
<p:themeSwitcher style="width:165px" effect="fade" var="th" id="themePreview" >
<f:selectItem itemLabel="Choose Theme" itemValue="" />
<f:selectItems value="#{themeBean.themesList}" var="theme" itemLabel="#{theme.name}" itemValue="#{theme}"/>
<p:column>
<p:graphicImage value="images/#{th.image}"/>
</p:column>
<p:column>
#{th.name}
</p:column>
</p:themeSwitcher>
</h:panelGrid>
</h:form>
ThemeBean
themesList= new ArrayList<Theme>();
themesList.add(new Theme("afterdark","afterdark.png"));
themesList.add(new Theme("aristo","aristo.png"));
themesList.add(new Theme("eggplant","eggplant.png"));
themesList.add(new Theme("humanity","humanity.png"));
themesList.add(new Theme("sunny","sunny.png"));
}
public List<Theme> getThemesList() {
return themesList;
}
public void setThemesList(List<Theme> themesList) {
this.themesList = themesList;
}
Theme.java
private String name;
private String image;
public Theme(String name, String image)
{
this.setImage(image);
this.setName(name);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
我遵循了主要面孔的例子。
我在构建路径xml中也配置了主题jar
但我在主题切换器(列表框)中没有得到选择
任何人都可以建议我做什么
答案 0 :(得分:1)