Java 如何在vaadin中设置图像数据源

Java 如何在vaadin中设置图像数据源,java,user-interface,gwt,datasource,vaadin7,Java,User Interface,Gwt,Datasource,Vaadin7,我有一个水平分割面板,我想显示在combobox中选择的图像,但无法设置图像文件的数据源 FilesystemContainer container = new FilesystemContainer(new File("C:/myData/wallpaper")); ComboBox box = new ComboBox("Documents", container); @Override protected void init(VaadinRequest request) {

我有一个水平分割面板,我想显示在combobox中选择的图像,但无法设置图像文件的数据源

FilesystemContainer container = new FilesystemContainer(new File("C:/myData/wallpaper"));
ComboBox box = new ComboBox("Documents", container);


@Override
    protected void init(VaadinRequest request) {
        setContent(box);

        com.vaadin.ui.HorizontalSplitPanel horizontalSplitPanel = new com.vaadin.ui.HorizontalSplitPanel();
        setContent(horizontalSplitPanel);
        horizontalSplitPanel.addComponent(box);
        //horizontalSplitPanel.addComponent(label);
        final Image image = new Image();
        horizontalSplitPanel.addComponent(image);
        box.addValueChangeListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                image.setData(event.getProperty().getValue());
                ///label.set//setPropertyDataSource( (Property) ImageIO.read((ImageInputStream) new TextFileProperty((File) event.getProperty().getValue())));

            }
        });

        box.setImmediate(true);
如何设置图像的数据源。我对Vaadin很陌生。

我建议这样做:

@Override
public void valueChange(ValueChangeEvent event) {
    image.setSource(new FileResource((File)box.getValue()));
}