> I tried adding the listener to the bxml file like so :
>
> <<PushButton bxml:id="pushButton" buttonData="Click Me!"
>
> ButtonPressListener.buttonPressed="Alert.alert(MessageType.INFO, "You
> clicked me!", CheckBoxes.this);"/>
You can use single quotes inside the attribute value, but this code wouldn't
work anyways - it is written in Java, and the default language in BXML is
JavaScript.
> So I guess my question to you is how do you suggest going about this
> problem(adding event listeners to buttons, or anything for that matter)
> going through the bxml file, programmatically through by implementing
> Bindable or both.
It's really up to you. I generally tend to wire up simple event handlers in
BXML and more complex handlers in Java.
> Also can you add buttons/checkboxes...etc in the bxml file AND the java
> class with window.add(myComponent).
Yes. BXML is just a shortcut to hand-coding your UI construction in Java, so
you can mix and match freely.
However, you can't add elements directly to a window via Window#add(). You'll
add them to your window's content. For example:
BoxPane content = new BoxPane();
content.add(new Label("Foo"));
content.add(new Label("Bar"));
window.setContent(content);
or:
<Window>
<!-- content tag is optional since it is Window's default property -->
<content>
<BoxPane bxml:id="content"/>
</content>
</Window>
content.add(new Label("Foo"));
content.add(new Label("Bar"));
where the calls to content.add() take place in the initialize() method.
G