令Sn GWT Widget Gallery e Google Web Toolkit- widgets Gallery-Mozlla Firefox Fle Edt yew So Bookmarks Tools Help 中,哈m9 m/webtoakit/documentation/com.9 nlegwt.doc.DeveloperGL,oa e Getting Started 5. Latest Headines "chek·、 AutoLink g AutoFil Sbarbe·回 optons o oogle Google Web Toolkit(Beta) Google Code Home >Google Web Toolkit >Developer Guide> Building User Interfaces Widgets Gallery s prex next> Google Web Toolkit Widgets Gallery Product OVerview Getting Started Guide The following are widgets and panels available in the GVT user-interface library Download SDK Button Developer Guide Normal Buton c Choice 1 c choice 2( Disabled) GWT Class Reference JRE Emulation Lbrary Web Toolkit FAO TextBox Web Toolkit Blog Developer Forum Normal Check Disabled Check Search Google PasswordextBox TextArea Search This is a big text Hyperlink Menus Layouts MenuBar Style Fruit Term 合foo@example.com a Inbox Italicized ode 3 Drafts 白 Templates Done To2hl/. ogle comlweboolkit 16
Source: http://code.google.com/webtoolkit/ 16 GWT Widget Gallery
今S Building User Interface C custom Composite Widget
Building User Interface: Custom Composite Widget
令Sn Custom Composite Widget Composite widget is a specialized widget that can contain another component typically, a panel) You can easily combine groups of existing widgets into a composite widget that is itself a reusable widget The most effective way to create new widgets k18
Source: http://code.google.com/webtoolkit/ 18 Custom Composite Widget • Composite widget is a specialized widget that can contain another component (typically, a panel) > You can easily combine groups of existing widgets into a composite widget that is itself a reusable widget • The most effective way to create new widgets
令Sn Example: Composite Widget public static class OptionalTextBox extends Composite implements ClickListener( private TextBox textBox= new TextBoX( private Check Box check Box = new Check Box( Constructs an Optional T extBox with the given caption on the check @param caption the caption to be displayed with the check bo public Optional TextBox(String caption)t l Place the check above the text box using a vertical panel VerticalPanel panel new VerticalPanel( panel. add(check Box): panel. add( textBox ) //Set the check box's caption, and check it by default check Box. setText(caption) checkBox. setChecked(true check Box. addClickListener(this) k19
Source: http://code.google.com/webtoolkit/ 19 Example: Composite Widget public static class OptionalTextBox extends Composite implements ClickListener { private TextBox textBox = new TextBox(); private CheckBox checkBox = new CheckBox(); /** * Constructs an OptionalTextBox with the given caption on the check. * * @param caption the caption to be displayed with the check box */ public OptionalTextBox(String caption) { // Place the check above the text box using a vertical panel. VerticalPanel panel = new VerticalPanel(); panel.add(checkBox); panel.add(textBox); // Set the check box's caption, and check it by default. checkBox.setText(caption); checkBox.setChecked(true); checkBox.addClickListener(this); // All composites must call initWidget() in their constructors. initWidget(panel); // Give the overall composite a style name. setStyleName("example-OptionalCheckBox"); } public void onClick(Widget sender) { if (sender == checkBox) { // When the check box is clicked, update the text box's enabled state. textBox.setEnabled(checkBox.isChecked()); } }
今S Building User Interface Event Handling d
Building User Interface: Event Handling