      /**
       * The constants used in this Content Widget.
       */
      public static interface CwConstants extends Constants,
          ContentWidget.CwConstants {
        String cwBasicTextAreaLabel();

        String cwBasicTextDescription();

        String cwBasicTextName();

        String cwBasicTextNormalLabel();

        String cwBasicTextPasswordLabel();

        String cwBasicTextReadOnly();

        String cwBasicTextSelected();
      }

      /**
       * An instance of the constants.
       */
      private CwConstants constants;

      /**
       * Initialize this example.
       */
      @Override
      public Widget onInitialize() {
        // Create a panel to layout the widgets
        VerticalPanel vpanel = new VerticalPanel();
        vpanel.setSpacing(5);

        // Add a normal and disabled text box
        TextBox normalText = new TextBox();
        normalText.ensureDebugId("cwBasicText-textbox");
        TextBox disabledText = new TextBox();
        disabledText.ensureDebugId("cwBasicText-textbox-disabled");
        disabledText.setText(constants.cwBasicTextReadOnly());
        disabledText.setEnabled(false);
        vpanel.add(new HTML(constants.cwBasicTextNormalLabel()));
        vpanel.add(createTextExample(normalText, true));
        vpanel.add(createTextExample(disabledText, false));

        // Add a normal and disabled password text box
        PasswordTextBox normalPassword = new PasswordTextBox();
        normalPassword.ensureDebugId("cwBasicText-password");
        PasswordTextBox disabledPassword = new PasswordTextBox();
        disabledPassword.ensureDebugId("cwBasicText-password-disabled");
        disabledPassword.setText(constants.cwBasicTextReadOnly());
        disabledPassword.setEnabled(false);
        vpanel.add(new HTML("<br><br>" + constants.cwBasicTextPasswordLabel()));
        vpanel.add(createTextExample(normalPassword, true));
        vpanel.add(createTextExample(disabledPassword, false));

        // Add a text area
        TextArea textArea = new TextArea();
        textArea.ensureDebugId("cwBasicText-textarea");
        textArea.setVisibleLines(5);
        vpanel.add(new HTML("<br><br>" + constants.cwBasicTextAreaLabel()));
        vpanel.add(createTextExample(textArea, true));

        // Return the panel
        return vpanel;
      }

      /**
       * Create a TextBox example that includes the text box and an optional
       * handler that updates a Label with the currently selected text.
       *
       * @param textBox the text box to handle
       * @param addSelection add handlers to update label
       * @return the Label that will be updated
       */
      private HorizontalPanel createTextExample(final TextBoxBase textBox,
          boolean addSelection) {
        // Add the text box and label to a panel
        HorizontalPanel hPanel = new HorizontalPanel();
        hPanel.setSpacing(4);
        hPanel.add(textBox);

        // Add handlers
        if (addSelection) {
          // Create the new label
          final Label label = new Label(constants.cwBasicTextSelected() + ": 0, 0");

          // Add a KeyUpHandler
          textBox.addKeyUpHandler(new KeyUpHandler() {
            public void onKeyUp(KeyUpEvent event) {
              updateSelectionLabel(textBox, label);
            }
          });

          // Add a ClickHandler
          textBox.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
              updateSelectionLabel(textBox, label);
            }
          });

          // Add the label to the box
          hPanel.add(label);
        }

        // Return the panel
        return hPanel;
      }

      /**
       * Update the text in one of the selection labels.
       *
       * @param textBox the text box
       * @param label the label to update
       */
      private void updateSelectionLabel(TextBoxBase textBox, Label label) {
        label.setText(constants.cwBasicTextSelected() + ": "
            + textBox.getCursorPos() + ", " + textBox.getSelectionLength());
      }