I want to be able to maximize and minimize my applet from a menuItem (in a menu).

Right now, I have it set up such that the menuItem is supposed to minimize the window, and another menuItem that is supposed to maximize the window (like the Minimize and Maximize button on the top right of most applications).

This is one of the menuItems:

menuItem = new JMenuItem ("Maximize Window", KeyEvent.VK_T);
                menuItem.setAccelerator (KeyStroke.getKeyStroke (KeyEvent.VK_1, ActionEvent.ALT_MASK));
        menuItem.getAccessibleContext ().setAccessibleDescription ("This doesn't really do anything");
        menuItem.addActionListener (this);
        menuItem.setActionCommand ("maximize");
        menu.add (menuItem);

And then, in actionPerformed, I have:

if (e.getActionCommand ().equals ("maximize"))
        {
            //Code goes here
        }

So how would I go about doing these two tasks?

Note: The Minimize action is in a different actionCommand/button/menuItem than the Maximize action.

Thank you

>I want to be able to maximize and minimize my applet from a menuItem

An applet is a small program that runs embedded in a Web browser’s web-page. As such, applet has a drawing or work area equal to an imaginary picture situated in the same spot.

However you can show/hide frame (window).