menuListen = new myMenuListener();
myMenu = new MenuBar();
MenuItem item = null;
//create the top level button
Menu File = new Menu("File");
item = new MenuItem("New",new MenuShortcut('N',false));
item.setActionCommand("deleteAllChairs");
item.addActionListener(menuListen);
File.add(item);
item = new MenuItem("Save Chair",new MenuShortcut('S',false));
item.setActionCommand("saveChairToFileAuto");
item.addActionListener(menuListen);
File.add(item);
item = new MenuItem("Save Chair As",new MenuShortcut('S',true));
item.setActionCommand("saveChairToFile");
item.addActionListener(menuListen);
File.add(item);
item = new MenuItem("Share Chair Online");
item.setActionCommand("ShareChairOnline");
item.addActionListener(menuListen);
File.add(item);
Menu Export = new Menu("Export Pattern");
item = new MenuItem("To PDF");
item.setActionCommand("savePDF");
item.addActionListener(menuListen);
Export.add(item);
item = new MenuItem("To SVG");
item.setActionCommand("savePattern");
item.addActionListener(menuListen);
Export.add(item);
item = new MenuItem("To DXF");
item.setActionCommand("savePatternDXF");
item.addActionListener(menuListen);
Export.add(item);
item = new MenuItem("Model To dxf");
item.setActionCommand("saveModelDxf");
item.addActionListener(menuListen);
Export.add(item);
item = new MenuItem("To craftRobo");
item.setActionCommand("saveCraftRobo");
item.setName(Integer.toString(UITools.DRAW_TOOL));
item.addActionListener(menuListen);
Export.add(item);
item = new MenuItem("To PNG Preview");
item.setActionCommand("exportPreview");
item.addActionListener(menuListen);
Export.add(item);
File.add(Export);
item = new MenuItem("Open",new MenuShortcut('O',false));
item.setActionCommand("openChairFromFile");
item.addActionListener(menuListen);
File.add(item);
/*
item = new MenuItem("open template chair");
item.setActionCommand("loadTemplateChair");
item.addActionListener(menuListen);
File.add(item);
*/
item = new MenuItem("import image");
item.setActionCommand("openEnvironmentFromFile");
item.addActionListener(menuListen);
File.add(item);
item = new MenuItem("import SVG");
item.setActionCommand("importSVG");
item.addActionListener(menuListen);
File.add(item);
item = new MenuItem("Print Preview");
item.setActionCommand("toggleView");
item.addActionListener(menuListen);
File.add(item);
if (SETTINGS.DEVELOPER_MODE) {
item = new MenuItem("Run Automated Actions");
item.setActionCommand("runAutomatedActions");
item.addActionListener(menuListen);
File.add(item);
}
//add the button to the menu
myMenu.add(File);
Menu Edit = new Menu("Edit");
item = new MenuItem("Copy" ,new MenuShortcut('C',false));
item.setActionCommand("copyChair");
item.addActionListener(menuListen);
Edit.add(item);
item = new MenuItem("Paste" ,new MenuShortcut('V',false));
item.setActionCommand("pasteChair");
item.addActionListener(menuListen);
Edit.add(item);
//create all the Menu Items and add the menuListener to check their state.
item = new MenuItem("Undo" ,new MenuShortcut('Z',false));
item.setActionCommand("undo");
item.addActionListener(menuListen);
Edit.add(item);
//create all the Menu Items and add the menuListener to check their state.
item = new MenuItem("Redo",new MenuShortcut('Z',true));
item.setActionCommand("redo");
item.addActionListener(menuListen);
Edit.add(item);
item = new MenuItem("Screen Capture");
item.setActionCommand("captureScreen");
item.addActionListener(menuListen);
Edit.add(item);
item = new MenuItem("Flip Chair");
item.setActionCommand("flipChair");
item.addActionListener(menuListen);
Edit.add(item);
myMenu.add(Edit);
Menu Tools = new Menu("Tools");
//create all the Menu Items and add the menuListener to check their state.
item = new MenuItem("Select");
item.setActionCommand("selectTool");
item.setName(Integer.toString(UITools.SELECT_TOOL));
item.addActionListener(menuListen);
Tools.add(item);
item = new MenuItem("Draw");
item.setActionCommand("selectTool");
item.setName(Integer.toString(UITools.DRAW_TOOL));
item.addActionListener(menuListen);
Tools.add(item);
item = new MenuItem("Leg");
item.setActionCommand("selectTool");
item.setName(Integer.toString(UITools.LEG_TOOL));
item.addActionListener(menuListen);
Tools.add(item);
item = new MenuItem("Path");
item.setActionCommand("selectTool");
item.setName(Integer.toString(UITools.DRAW_PATH_TOOL));
item.addActionListener(menuListen);
Tools.add(item);
item = new MenuItem("Bezier");
item.setActionCommand("selectTool");
item.setName(Integer.toString(UITools.SELECT_BEZIER_TOOL));
item.addActionListener(menuListen);
Tools.add(item);
item = new MenuItem("Scale");
item.setActionCommand("selectTool");
item.setName(Integer.toString(UITools.SCALE_TOOL));
item.addActionListener(menuListen);
Tools.add(item);
item = new MenuItem("Measure");
item.setActionCommand("selectTool");
item.setName(Integer.toString(UITools.MEASURE_TOOL));
item.addActionListener(menuListen);
Tools.add(item);
Menu camera = new Menu("Camera");
item = new MenuItem("zoom");
item.setActionCommand("selectTool");
item.setName(Integer.toString(UITools.ZOOM_CAM_TOOL));
item.addActionListener(menuListen);
camera.add(item);
item = new MenuItem("pan");
item.setActionCommand("selectTool");
item.setName(Integer.toString(UITools.MOVE_CAM_TOOL));
item.addActionListener(menuListen);
camera.add(item);
item = new MenuItem("rotate");
item.setActionCommand("selectTool");
item.setName(Integer.toString(UITools.ROTATE_CAM_TOOL));
item.addActionListener(menuListen);
camera.add(item);
Menu View = new Menu("View");
item = new MenuItem("front");
item.setActionCommand("camJumpFront");
item.addActionListener(menuListen);
View.add(item);
item = new MenuItem("side");
item.setActionCommand("camJumpSide");
item.addActionListener(menuListen);
View.add(item);
item = new MenuItem("top");
item.setActionCommand("camJumpTop");
item.addActionListener(menuListen);
View.add(item);
item = new MenuItem("isometric");
item.setActionCommand("camJumpIso");
item.addActionListener(menuListen);
View.add(item);
camera.add(View);
Tools.add(camera);
myMenu.add(Tools);
Menu layers = new Menu("Layers");
item = new MenuItem("Select Next",new MenuShortcut(KeyEvent.VK_LEFT,false));
item.setActionCommand("layersSelectNext");
item.addActionListener(menuListen);
layers.add(item);
item = new MenuItem("Select Prev",new MenuShortcut(KeyEvent.VK_RIGHT,false));
item.setActionCommand("layersSelectPrev");
item.addActionListener(menuListen);
layers.add(item);
myMenu.add(layers);
Menu physics = new Menu("Physics");
item = new MenuItem("play/pause",new MenuShortcut('G',false));
item.setActionCommand("physicsPlayPause");
item.addActionListener(menuListen);
physics.add(item);
item = new MenuItem("rewind",new MenuShortcut('G',true));
item.setActionCommand("physicsRewind");
item.addActionListener(menuListen);
physics.add(item);
myMenu.add(physics);
Menu Mode = new Menu("Mode");
item = new MenuItem("Basic");
item.setActionCommand("changeModeBasic");
item.addActionListener(menuListen);
Mode.add(item);
item = new MenuItem("Expert");
item.setActionCommand("changeModeExpert");
item.addActionListener(menuListen);
Mode.add(item);
item = new MenuItem("Make It",new MenuShortcut('M',false));
item.setActionCommand("viewPattern");
item.addActionListener(menuListen);
Mode.add(item);
item = new MenuItem("Build It",new MenuShortcut('B',false));
item.setActionCommand("viewModel");
item.addActionListener(menuListen);
Mode.add(item);
myMenu.add(Mode);
Menu view = new Menu("View");
item = new MenuItem("Snap to Grid",new MenuShortcut('I',true));
item.setActionCommand("toggleGrid");
item.addActionListener(menuListen);
view.add(item);
item = new MenuItem("Ergonomic Figure",new MenuShortcut('E',false));
item.setActionCommand("togglePerson");
item.addActionListener(menuListen);
view.add(item);
item = new MenuItem("Floor",new MenuShortcut('F',false));
item.setActionCommand("toggleFloor");
item.addActionListener(menuListen);
view.add(item);
myMenu.add(view);
/*
Menu Language = new Menu("Language");
item= new MenuItem("English");
item.setActionCommand("selectLanguage");
item.setName(Integer.toString(UITools.LANGUAGE_ENG));
item.addActionListener(menuListen);
Language.add(item);
item= new MenuItem("Japanese");
item.setActionCommand("selectLanguage");
item.setName(Integer.toString(UITools.LANGUAGE_JP));
item.addActionListener(menuListen);
Language.add(item);
myMenu.add(Language);
*/
if (GLOBAL.frame == null)
return;
//add the menu to the frame!
GLOBAL.frame.setMenuBar(myMenu);
Menu Help = new Menu("Help");
item = new MenuItem("About");
item.setActionCommand("selectTool");
item.setName(Integer.toString(UITools.ZOOM_CAM_TOOL));
item.addActionListener(menuListen);
Help.add(item);
/*
item= new MenuItem("Show Instructions");
item.setActionCommand("showInstructions");
item.addActionListener(menuListen);
Help.add(item);
item= new MenuItem("Show Instruction Movie");
item.setActionCommand("showInstructionMovie");
item.addActionListener(menuListen);
Help.add(item);
*/
if (!System.getProperty("java.version").startsWith("1.5")) {
item = new MenuItem("reference");
item.setActionCommand("showReferenceWebpage");
item.addActionListener(menuListen);
Help.add(item);
item = new MenuItem("forum");
item.setActionCommand("showForumWebpage");
item.addActionListener(menuListen);
Help.add(item);
item = new MenuItem("report a bug");
item.setActionCommand("showBugsWebpage");
item.addActionListener(menuListen);
Help.add(item);
}
myMenu.add(Help);