Window Menu - Sample Applications
Samples IndexWindowMenu is added to the MenuBar of the following Sample

The WindowMenu with already developed MenuItems

Cascading all opened windows

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();
}
}


