java changeevent_Java ValueChangeEvent类代码示例

import com.vaadin.v7.data.Property.ValueChangeEvent; //导入依赖的package包/类

@SuppressWarnings("deprecation")

public SwipeViewWithNormalContent() {

CssLayout cssLayout = new CssLayout();

cssLayout.addComponent(new Button("Button"));

Form form = new Form();

FormLayout layout = (FormLayout) form.getLayout();

layout.setMargin(false);

form.setSizeUndefined();

CheckBox cb = new CheckBox();

cb.setCaption("Loop views");

cb.addValueChangeListener(new Property.ValueChangeListener() {

public void valueChange(ValueChangeEvent event) {

loop = !loop;

if (loop) {

setNextComponent(images[0]);

} else {

setNextComponent(null);

}

}

});

cb.setImmediate(true);

form.addField("loop", cb);

TextField tf = new TextField("Foo");

tf.setWidth("100%");

tf.setValue("This is a test page that shows SwipeView can also contain other stuff but just images :-)");

form.addField("foo", tf);

form.addField("bar", new CheckBox("Bar"));

NativeSelect field = new NativeSelect();

field.setCaption("Car");

field.addItem("Foo");

field.addItem("Bar");

field.addItem("Car");

form.addField("car", field);

VerticalComponentGroup fg = new VerticalComponentGroup();

fg.setCaption("Form");

fg.addComponent(form);

cssLayout.addComponent(fg);

VerticalComponentGroup verticalComponentGroup = new VerticalComponentGroup();

verticalComponentGroup

.setCaption("Labels to make this view heavy");

for (int i = 0; i < 40; i++) {

verticalComponentGroup

.addComponent(new Label("Label " + i));

}

cssLayout.addComponent(verticalComponentGroup);

setContent(cssLayout);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值