我正在 wicket 中寻找 spinner,它应该与 java swing 中的 JSpinner 类似。我找到了类(class):http://www.jarvana.com/jarvana/view/org/wicketstuff/minis/1.4.9/minis-1.4.9-javadoc.jar!/org/wicketstuff/minis/spinner/Spinner.html在 wicket minis 的东西中,但我没有找到任何文档如何在 html 代码中使用它。我尝试在我的 Maven 中添加迷你示例,但没有成功:
<dependency>
<groupId>org.wicketstuff</groupId>
<artifactId>minis-examples</artifactId>
<version>1.4.9.2</version>
</dependency>
仍然存在缺少工件 org.wicketstuff:minis-examples:jar:1.4.9.2:compile
是否还有其他具有良好文档的类 spinner 在哪里?
更新:
我尝试这样的事情:
TextField<Integer> text = new TextField<Integer>("skupina");
Spinner spinner = new Spinner() {
private static final long serialVersionUID = 1L;
@Override
protected void configure(Properties p) {
p.put("min", 1);
super.configure(p);
}
};
text.add(spinner);
add(text);
但我不知道错误在哪里,因为我没有找到任何例子。 Thuis 抛出异常:
java.lang.NoSuchMethodError: org.apache.wicket.Component.getResponse()Lorg/apache/wicket/Response; 在 org.wicketstuff.minis.spinner.Spinner.beforeRender(Spinner.java:152) 在 org.apache.wicket.Component.notifyBehaviorsComponentBeforeRender(Component.java:3486) 在 org.apache.wicket.Component.internalRender(Component.java:2368) 在 org.apache.wicket.Component.render(Component.java:2297)
最佳答案
Spinner
类定义的不是组件,而是组件的行为。
如 wicketstuff-minis Javadoc 中所述
This behavior is used to augment a
TextField
with spinning abilities. For customization of the Spinner take a look at theconfigure(Properties)
method.
我从来没有使用过这个,但看起来,你只需要实例化一个正常 wicket TextField
,a和add properly configured spinner behavior到它。
关于java - 如何在 Wicket 口创建旋转器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11879749/