我用VaadIn实验室的视觉设计师创建了一个Vaadin设计
它是一个基本的登录面板
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" name="design-properties" content="{"RULERS_VISIBLE":true,"GUIDELINES_VISIBLE":false,"SNAP_TO_OBJECTS":true,"SNAP_TO_GRID":true,"SNAPPING_DISTANCE":10.0,"PAPER_WIDTH":1440,"PAPER_HEIGHT":900,"JAVA_SOURCES_ROOT":"src","THEME":"sws_7_2"}">
</head>
<body>
<v-panel caption="Login" width="40%" height="40%" _id="login">
<v-vertical-layout spacing="true" size-full="true" margin="">
<v-horizontal-layout spacing="true" width-full="true">
<v-label size-auto="true" plain-text="" :middle="" :right="" _id="lblLoginName">
Login naam :
</v-label>
<v-text-field :middle="" _id="txtLoginName"></v-text-field>
</v-horizontal-layout>
<v-horizontal-layout spacing="true" width-full="true">
<v-label size-auto="true" plain-text="" :middle="" :right="" _id="lblPassword">
Paswoord :
</v-label>
<v-text-field :middle="" _id="txtPassword"></v-text-field>
</v-horizontal-layout>
<v-horizontal-layout spacing="true" width-full="true">
<v-button plain-text="" :middle="" :right="" _id="btnLogin">
Login
</v-button>
<v-button plain-text="" :middle="" _id="btnCancel">
Annuleren
</v-button>
</v-horizontal-layout>
<v-horizontal-layout spacing="true" width-full="true">
<v-button plain-text="" :middle="" :center="" _id="btnLoginPasswordForgotten">
Login / paswoord vergeten?
</v-button>
</v-horizontal-layout>
<v-horizontal-layout width-full="true">
<v-label width="6px" plain-text="" :middle="" :center="" _id="lblError"></v-label>
</v-horizontal-layout>
</v-vertical-layout>
</v-panel>
</body>
</html>
当我调用loginscreen (下面的代码)时,我看到了它,但是我不能用它做任何事情。ClickListner不起作用了,我甚至不能改变标签值什么的.
public class Login extends LoginDesign implements Button.ClickListener {
private static final long serialVersionUID = 1L;
private UI mainUI;
private ClickListener listner = this;
public Panel createLoginPanel(UI mainUI) {
this.mainUI = mainUI;
LoginDesign login = new LoginDesign();
btnLogin.addClickListener(listner);
lblError.setValue("Problem");
System.out.println(lblError.getValue());
return login;
}....我在控制台中看到了更改后的lblError值,但没有在屏幕上看到.?
通常,您创建按钮并添加标题和侦听器。在这里我需要分别添加听者. ?!
我做错了什么..。有什么建议吗?谢谢!
发布于 2015-05-06 07:29:34
解决了。
我使用了一个生成文件的实例,但是您需要使用扩展类..。
public class Login extends LoginDesign implements Button.ClickListener {
private static final long serialVersionUID = 1L;
private UI mainUI;
private ClickListener listner = this;
public Panel createLoginPanel(UI mainUI) {
this.mainUI = mainUI;
Login login = new Login();
btnLogin.addClickListener(listner);
lblError.setValue("Problem");
System.out.println(lblError.getValue());
return login;
}....解决了
https://stackoverflow.com/questions/30064292
复制相似问题