The buttonPressed method is passed a reference to the Button which was pressed.
You can call button.getDisplay() or button.getWindow() and use those
as when opening the new window.

http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/ButtonPressListener.html#buttonPressed(org.apache.pivot.wtk.Button)
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/Component.html#getDisplay()
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/Component.html#getWindow()

After you have opened the new window, you will probably close the
login WIndow and may also want to resize the native frame (if it is a
desktop application).
You can use this method to do the resizing.
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/DesktopApplicationContext.html#sizeHostToFit(org.apache.pivot.wtk.Window)

Chris

2011/11/30 Brendan cheng <[email protected]>:
> Hi,
> I wrote a login screen which has a button of registration.  When the button
> of registration is pressed, the registration is loaded from bxml file.  But
> I don't know how to show it on window.
> here is the snippet from my login java.
>
> @Override
>
> public void initialize(Map<String, Object> namespace, URL location,
>
> final Resources resources) {
>
> // TODO Auto-generated method stub
>
> registerButton = (PushButton) namespace.get("registerButton");
>
> registerButton.getButtonPressListeners().add(new ButtonPressListener() {
>
> @Override
>
> public void buttonPressed(Button button) {
>
> BXMLSerializer bxmlSerializer = new BXMLSerializer();
>
> try {
>
> registerWindow = (RegisterWindow) bxmlSerializer.readObject(getClass()
>
> .getResource("Register_window.bxml"), resources);
>
> // registerWindow.open(display);  <-------------??????
>
> } catch (IOException e) {
>
> // TODO Auto-generated catch block
>
> e.printStackTrace();
>
> } catch (SerializationException e) {
>
> // TODO Auto-generated catch block
>
> e.printStackTrace();
>
> }
>
> }
>
> });
>
> }
>
> Thanks in advance!

Reply via email to