Site Map Mail This To A Friend PrivacyPolicy Subscribe to MakeLogic RSS Feed

Window Menu - Sample Applications

Samples Index

WindowMenu is added to the MenuBar of the following Sample Window Menu ScreehShot

The WindowMenu with already developed MenuItems Window Menu ScreehShot

Cascading  all opened windows Window Menu ScreehShot

WindowMenu is added to the MenuBar of the following Sample
The WindowMenu with predeveloped MenuItems
Cascading all opened windows

Sample 1:-
/*
* @(#)AddWindowMenuExample.java
*
* Product Of : MakeLogic
* URL : http://www.makelogic.com
* Author : R.Venkatesh
* Date : 1 July, 2003
* email : venkat@makelogicmldb.com
*
* Please feel free to use this Sample Code in your applications.
*/
  /*
* This sample Application Demonstrates how to use the WindowMenu Object and add
* it into your menuBar.
*/

import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JLabel;
import javax.swing.KeyStroke;
import com.makeLogic.utils.WindowMenu;


public class AddWindowMenuExample extends JFrame
{
 
//...Fields
JDesktopPane desktop;
JMenuBar menuBar;

//...Constructors
public AddWindowMenuExample()
{
    super("MakeLogic – Add WindowMenu Example");
    //Quit this app when the big window closes.
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }

});

//Set up the GUI.

desktop = new JDesktopPane(); //the container which will host components(InternalFrames)
desktop.putClientProperty("JDesktopPane.dragMode", "outline");
getContentPane().setLayout(new BorderLayout());
getContentPane().add(desktop,BorderLayout.CENTER);
//add a few internal frames to the desktop pane
for(int i=0;i<5;i++){

    addFrame("InternalFrame : "+ i);

}

//..sets the destop object to the ContentaPane

setContentPane(desktop);

//.. Creates a JMenuBar which hosts all the readymade Menus

menuBar = new JMenuBar();

//...WindowMenu
//..Creates the ReadyMade WindowMenu

WindowMenu windowMenu = new WindowMenu(desktop);


//..adds the windowMenu to the MenuBar

menuBar.add(windowMenu);

//..sets the MenuBar to the Container(desktop)

setJMenuBar(menuBar);

}

//...methods
public void addFrame(String title)
{

    //..InternalFrame
    JInternalFrame internalFrame = new JInternalFrame(title);

    //..Venkat Start
    JLabel testLabel = new JLabel();
    testLabel.setText(title);
    desktop.add("South",testLabel);

    //.. Venkat End
    //..set the Frame Window Size
    internalFrame.setSize(200,150);

    //..show the InternalFrame
    internalFrame.show();

    //..add the InternalFrame to the container(desktop)
    desktop.add(internalFrame);

}

//Add the main method
public static void main(String args[])
{

    AddWindowMenuExample windowMenuExample = new AddWindowMenuExample();
    windowMenuExample.setSize(400,300);
    windowMenuExample.validate();
    windowMenuExample.show();

}
}


Was this information helpful to you?
Rock The Vote Next Poll Question

RSS Feeds
Subscribe to MakeLogic RSS Feed Add to My Yahoo! Add to Google
NewsLetter