I want to use MessageBox.confirm to confirm a user action. In the explorer demo there is an example, but it is using the text of the button to determine which one was pressed. I cant do that because my buttons are going to have differrent texts at runtime.

How can I determine if the Okay button or the cancel button was pressed?

Also i would like to change the text of the buttons (i18n)

final Listener<WindowEvent> l = new Listener<WindowEvent>() {
            public void handleEvent(WindowEvent ce) {
                Dialog dialog = (Dialog) ce.component;
                Button btn = dialog.getButtonPressed();
                Info.display("MessageBox", "The '{0}' button was pressed", btn.

        MessageBox.confirm("Confirm", "Are you sure you want to do that?", l);