GWT-EXT如何验证字段呢?

表单里有“密码”和“确认密码”两个字段,当我输入“确认密码”时,怎样才能验证其与“密码”一致呢?

我想要的效果就是当“确认密码”和“密码”不相同时,“确认密码”输入框旁边会出现一个错误提示!

[code="java"]VerticalPanel vp = new VerticalPanel();

    vp.add(title);
    vp.add(description);

    final PasswordTextBox pbox1 = new PasswordTextBox();
    final PasswordTextBox pbox2 = new PasswordTextBox();

    final Label label = new Label();

    VerticalPanel panel = new VerticalPanel ();
    FlowPanel topPanel = new FlowPanel();
    FlowPanel bottomPanel = new FlowPanel();

    panel.add(topPanel);
    panel.add(bottomPanel);

    topPanel.add(pbox1);
    bottomPanel.add(pbox2);
    bottomPanel.add(label);

    pbox1.addFocusListener(new FocusListener()
    {

        public void onFocus(Widget sender) {
        }

        public void onLostFocus(Widget sender) {
            if(!pbox1.getText().equals(pbox2.getText()))
            {
                label.setText("password is not same!");
            }
            else
            {
                label.setText("");
            }
        }
    });

    RootPanel.get().add(panel);[/code]