class RupsMenuBar extends JMenuBar implements Observer {

    /**
     * Caption for the file menu.
     */
    public static final String FILE_MENU = "File";
    /**
     * Caption for "Open file".
     */
    public static final String OPEN = "Open";
    /**
     * Caption for "Close file".
     */
    public static final String CLOSE = "Close";
    /**
     * Caption for the help menu.
     */
    public static final String HELP_MENU = "Help";
    /**
     * Caption for "Help about".
     */
    public static final String ABOUT = "About";
    /**
     * Caption for "Help versions".
     *
     * @since iText 5.0.0 (renamed from VERSIONS)
     */
    public static final String VERSION = "Version";
    /**
     * A Serial Version UID.
     */
    private static final long serialVersionUID = 6403040037592308742L;
    /**
     * The Observable object.
     */
    protected Observable observable;
    /**
     * The action needed to open a file.
     */
    protected FileChooserAction fileChooserAction;
    /**
     * The HashMap with all the actions.
     */
    protected HashMap<String, JMenuItem> items;

    /**
     * Creates a JMenuBar.
     *
     * @param observable the controller to which this menu bar is added
     */
    public RupsMenuBar(Observable observable) {
        this.observable = observable;
        items = new HashMap<>();
        fileChooserAction = new FileChooserAction(observable, "Open", PdfFilter.INSTANCE, false);
        MessageAction message = new MessageAction();
        JMenu file = new JMenu(FILE_MENU);
        addItem(file, OPEN, fileChooserAction);
        addItem(file, CLOSE, new FileCloseAction(observable));
        add(file);
        add(Box.createGlue());
        JMenu help = new JMenu(HELP_MENU);
        addItem(help, ABOUT, message);
        addItem(help, VERSION, message);
        add(help);
        enableItems(false);
    }

    /**
     * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
     */
    public void update(Observable observable, Object obj) {<FILL_FUNCTION_BODY>}

    /**
     * Create an item with a certain caption and a certain action, then add the item to a menu.
     *
     * @param menu    the menu to which the item has to be added
     * @param caption the caption of the item
     * @param action  the action corresponding with the caption
     */
    protected void addItem(JMenu menu, String caption, ActionListener action) {
        JMenuItem item = new JMenuItem(caption);
        item.addActionListener(action);
        menu.add(item);
        items.put(caption, item);
    }

    /**
     * Enables/Disables a series of menu items.
     *
     * @param enabled true for enabling; false for disabling
     */
    protected void enableItems(boolean enabled) {
        enableItem(CLOSE, enabled);
    }

    /**
     * Enables/disables a specific menu item
     *
     * @param caption the caption of the item that needs to be enabled/disabled
     * @param enabled true for enabling; false for disabling
     */
    protected void enableItem(String caption, boolean enabled) {
        items.get(caption).setEnabled(enabled);
    }
}

        if (OPEN.equals(obj)) {
            enableItems(true);
            return;
        }
        if (CLOSE.equals(obj)) {
            enableItems(false);
            return;
        }
        if (FILE_MENU.equals(obj)) {
            fileChooserAction.actionPerformed(null);
        }
    
<methods>public void <init>() ,public javax.swing.JMenu add(javax.swing.JMenu) ,public void addNotify() ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public java.awt.Component getComponent() ,public java.awt.Component getComponentAtIndex(int) ,public int getComponentIndex(java.awt.Component) ,public javax.swing.JMenu getHelpMenu() ,public java.awt.Insets getMargin() ,public javax.swing.JMenu getMenu(int) ,public int getMenuCount() ,public javax.swing.SingleSelectionModel getSelectionModel() ,public javax.swing.MenuElement[] getSubElements() ,public javax.swing.plaf.MenuBarUI getUI() ,public java.lang.String getUIClassID() ,public boolean isBorderPainted() ,public boolean isSelected() ,public void menuSelectionChanged(boolean) ,public void processKeyEvent(java.awt.event.KeyEvent, javax.swing.MenuElement[], javax.swing.MenuSelectionManager) ,public void processMouseEvent(java.awt.event.MouseEvent, javax.swing.MenuElement[], javax.swing.MenuSelectionManager) ,public void removeNotify() ,public void setBorderPainted(boolean) ,public void setHelpMenu(javax.swing.JMenu) ,public void setMargin(java.awt.Insets) ,public void setSelected(java.awt.Component) ,public void setSelectionModel(javax.swing.SingleSelectionModel) ,public void setUI(javax.swing.plaf.MenuBarUI) ,public void updateUI() <variables>private static final boolean DEBUG,private static final boolean TRACE,private static final boolean VERBOSE,private java.awt.Insets margin,private boolean paintBorder,private transient javax.swing.SingleSelectionModel selectionModel,private static final java.lang.String uiClassID