Keeping the menu bar on the screen when all windows are closed

  1. Set up a special menu bar to be used when no windows are open.

  2. Add this to your first frame.

  3. Set its size to zero.

  4. Set its location to negative coordinates.

  5. Display the frame.

    PlayerFrame(boolean invisible) {
        super("");
        this.setUndecorated(true);
        this.setSize(0, 0);
        CONTROL_BAR_HEIGHT = 0;
        JMenuBar menubar = new PlayerMenuBar(null);
        this.setJMenuBar(menubar);
        this.pack();
    }

Be careful if you have any bring to Front/Send to Back/Move Forward/Move backward functionality


Previous | Next | Top | Cafe con Leche

Copyright 2005, 2006 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified January 18, 2006