当我使用此代码时,结果为空页:
public class Vaadin6biuApplication extends Application {
@Override
public void init() {
xx a = new xx();
Window w = new Window("aness conf");
w.addComponent(a);
setMainWindow(w);
}
}
public class xx extends CustomComponent {
@AutoGenerated
private AbsoluteLayout mainLayout;
@AutoGenerated
private Button button_1;
public xx() {
buildMainLayout();
setCompositionRoot(mainLayout);
}
@AutoGenerated
private AbsoluteLayout buildMainLayout() {
mainLayout = new AbsoluteLayout();
mainLayout.setImmediate(false);
button_1 = new Button();
mainLayout.addComponent(button_1, "top:100.0px;left:100.0px;");
return mainLayout;
}
}
如何向应用程序添加自定义组件? 谢谢你的回答
答案 0 :(得分:0)
您是否阅读了wiki tutorial vaadin6 + spring?随着春天> 2.5它很简单:
@Configurable(preConstruction = true)
public class SpringHelloWorld extends com.vaadin.Application {
@Autowired
private MyBeanInterface bean;
public void init() {
final Window main = new Window("Hello window");
setMainWindow(main);
main.addComponent(new Label( bean.myMethod() ));
}
}