Search code examples
javaswingjframejinternalframe

Title bar not working properly on JInternalFrame


I have a JInternalFrame class with a constructor that looks like this:

public MyInternalFrame() {
        super("Name");
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(AutogeneFrame.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            Logger.getLogger(AutogeneFrame.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(AutogeneFrame.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedLookAndFeelException ex) {
            Logger.getLogger(AutogeneFrame.class.getName()).log(Level.SEVERE, null, ex);
        }

        initComponents();

    }

The problem is that the maximize, minimize, and exit buttons that should be in the top left corner of the window do not show up. However, the title "Name" does show up in the center of the title bar. I'm on a Mac, and rather than having the three little circles (red, yellow, and green) that are in the top left corner of all windows, they just appear as three little gray circles that are not clickable


Solution

  • You're constructing the JInternalFrame that "Creates a non-resizable, non-closable, non-maximizable, non-iconifiable JInternalFrame with the specified title." You want the one like this:

    super("Name", true, true, true, true);