Checkbox 的狀態可以為 checked 和 unchecked. 其值可以通過 getValue, setValue 來操作。基本用法如下:// A check box with default state (not checked, false).final CheckBox checkbox1 = new CheckBox("My CheckBox");main.addComponent(checkbox1);// Another check box with explicitly set checked state.
RichTextArea 允許輸入帶格式的文本。 RichTextArea 內容以 HTML 格式顯示。它繼承自TextArea,本身沒有提供什麼附加功能,你可以通過擴展 VRichTextArea, VRichTextToolbar 的方法來為 RichTextArea 添加客戶端功能。// Create a rich text areafinal RichTextArea rtarea = new RichTextArea();rtarea.setCaption("My Rich Text Area");
前面 TextField 一般為單行顯示,而 TextArea 為多行顯示。基本用法如下:/ Create the areaTextArea area = new TextArea("Big Area");// Put some content in itarea.setValue("A row\n"+ "Another row\n"+ "Yet another row");setRows() 定義 TextArea 的行數。
TextField 文本框,可以接受用戶輸入文字。它實現 Field 介面,支持數據綁定。基本用法:// Create a text fieldTextField tf = new TextField("A Field");// Put some initial content in ittf.setValue("Stuff in the field");顯示如下:支持 Field 介面的 UI 組件,可以通過 Property.ValueChangeListener 來監視 Value 的變化。
組件 Link 為超鏈接。指向一個外部資源。 Link 實際為一HTML 鏈接。和 Button 不同的是,Link 不會在伺服器端觸發一個事件。你也可以使用 setIcon 為 Link 添加一個圖標:// Textual linkLink link = new Link("Click Me!", new ExternalResource("http://vaadin.com/")); ...
Vaadin 應用程序框架為一伺服器端技術,允許開發人員採用和開發桌面應用類似的方法開發 Web 應用。儘管 Vaadin 底層採用了 HTML,JavaScript,AJAX 等 Web 技術,Vaadin 應用程序框架很好的隱藏了這些細節,開發人員一般無需了解上述 Web 技術來開發 Vaadin 應用。