1

I am new to Apache Pivot.

I am tryng to make a simple window with menu bar.

The code I used to load the main frame is:

public class MyApp implements Application {
    private Frame frame;

    @Override
    public void startup(Display display, Map<String, String> strings) throws Exception {
        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        frame = (Frame)bxmlSerializer.readObject(MyApp.class, "/gui/MainFrame.bxml");
        frame.open(display);
    }

    @Override
    public boolean shutdown(boolean b) throws Exception {
        if(frame != null) {
            frame.close();
        }

        return false;
    }

    @Override
    public void suspend() throws Exception {

    }

    @Override
    public void resume() throws Exception {

    }

    public static void main(String[] args) {
        DesktopApplicationContext.main(MyApp.class, args);
    }
}

The main frame BXML is like:

<root:MainFrame title="MyApp" maximized="true"
        xmlns:bxml="http://pivot.apache.org/bxml"
        xmlns="org.apache.pivot.wtk"
        xmlns:root="com.myproject.client">

    <menuBar>
        <bxml:include src="wtk/menubar.bxml"/>
    </menuBar>
</root:MainFrame>

The MainFrame.java is like:

public class MainFrame extends Frame implements Bindable {
    public MainFrame() {
        Action.getNamedActions().put("myaction1", new Action() {
            @Override
            public void perform(Component source) {
                 ......
            }
        });
    }
}

The result of this code is like the picture below:

enter image description here

As you can see there is an Mac window outside and a frame window inside.

My question is that how can I get rid of the system window OR get rid of the frame window so that only one window is shown?

Thank you very much.

Kevin
  • 5,972
  • 17
  • 63
  • 87

1 Answers1

0

I found a 2012 mailing list post that implies Pivot has no support for native menus, so your app will always live within the system window.

However, that mailing list post did suggest a hack using Java AWT Frame to get system menus.

bramp
  • 9,581
  • 5
  • 40
  • 46