please dont rip this site

Language Java Nosugar Custom Imagine Code Imagineframe.java

// 
//	ImagineFrame class
//	A non functional copy of the imagine user interface
//	to be used in a web tutorial
//
//	Copyright (c) 1997 Sunil Gupta, sunil@magnetic.demon.co.uk
//	placed into the public domain by the author
//
//	Imagine is a trademark and copyright of
//	Impulse Inc, http://www.coolfun.com/
//
import java.awt.*;

import IndexedMenu;
import HasID;
import ImagineView;
import WorldLayout;
import WorldConstraints;

public class ImagineFrame extends Frame
{
	public ImagineFrame()
	{
		super("Imagine Tutorial");
		init();
	}
	  
	public boolean handleEvent(Event e)
	{
		Object obj;
		int ID;
		
		
		obj = e.target;
		ID = e.id;
		
		
		if (ID == Event.WINDOW_DESTROY)
		{
			this.hide();
			this.dispose();
			return( true);
		}
		
		if (obj instanceof HasID)
		{
			perform_function( ( (HasID)obj ).getID(), obj );
			return true;
		}
		
		return false;
	}
	
	private void init()
	{
		ImagineView thing;
		WorldLayout layout;
		WorldConstraints constraints;
		Panel panel;
		
		//------------generate the menu bar, complex stuff---------
		this.setMenuBar( create_menu_bar());
		this.setLayout( new BorderLayout());
		panel = new Panel();
		this.add("Center", panel);

		
		//------------generate tri-views------------------------------
		layout = new WorldLayout();
		panel.setLayout(layout);
		
		//------------generate tri-views------------------------------
		thing = new ImagineView(ImagineView.TOP);
		constraints = new WorldConstraints(0.0, 0.0);
		constraints.resizeX = true;
		constraints.resizeY = true;
		constraints.setSize(50.0, 50.0);
		layout.setConstraints( thing, constraints);
		panel.add(thing);
		
		thing = new ImagineView(ImagineView.FRONT);
		constraints = new WorldConstraints(0.0, 50.0);
		constraints.resizeX = true;
		constraints.resizeY = true;
		constraints.setSize(50.0, 50.0);
		layout.setConstraints( thing, constraints);
		panel.add(thing);

		thing = new ImagineView(ImagineView.PERSPECTIVE);
		constraints = new WorldConstraints(50.0, 0.0);
		constraints.resizeX = true;
		constraints.resizeY = true;
		constraints.setSize(50.0, 50.0);
		layout.setConstraints( thing, constraints);
		panel.add(thing);

		thing = new ImagineView(ImagineView.RIGHT);
		constraints = new WorldConstraints(50.0, 50.0);
		constraints.resizeX = true;
		constraints.resizeY = true;
		constraints.setSize(50.0, 50.0);
		layout.setConstraints( thing, constraints);
		panel.add(thing);
	}
	
	//**********************************************************
	//				Pulldown menus
	//**********************************************************
	private MenuBar create_menu_bar()
	{
		MenuBar menubar;
		
		menubar = new MenuBar();
		menubar.add( make_edit_menu()	);
		menubar.add( make_view_menu()	);
		menubar.add( make_object_menu()	);
		menubar.add( make_mode_menu()	);
		menubar.add( make_functions_menu());
		menubar.add( make_pick_menu()	);
		menubar.add( make_states_menu()	);
		menubar.add( make_about_menu()	);
		
		return menubar;
	}
		
	//-----------------------------------------------------------
	private IndexedMenu make_edit_menu()
	{
		IndexedMenu menu;
										
		menu = new IndexedMenu("&Editor");
		menu.add( "&Detail Editor",			ImagineFunctions.edit_Detail);
		menu.add( "&Forms Editor",			ImagineFunctions.edit_Forms);
		menu.add( "Sp&line Editor",			ImagineFunctions.edit_Spline);
		menu.add( "&Stage Editor",			ImagineFunctions.edit_Stage);
		menu.addSeparator();				
		menu.add( "&Preferences",			ImagineFunctions.edit_Preferences);
		menu.addSeparator();				
		menu.add( "&Undo",					ImagineFunctions.edit_Undo);
		menu.add( "&QuickRender",			ImagineFunctions.edit_QuickRender);
		menu.add( "&View Image",			ImagineFunctions.edit_View);
		menu.add( "&Play AVI",				ImagineFunctions.edit_Play);
		menu.addSeparator();			
		menu.add( "E&xit",					ImagineFunctions.edit_Exit);
		
		return menu;
	}
	
	//-----------------------------------------------------------
	private IndexedMenu make_view_menu()
	{
		IndexedMenu menu, submenu;
		
		menu = new IndexedMenu("&View");
		menu.add( "&Toolbars ...",			ImagineFunctions.view_Toolbars);
		menu.add( "&Status Bar",			ImagineFunctions.view_Status);
		menu.addSeparator();
		
		//- - - - - - - - - - - - - - - - - - - - - - - - - -
		submenu = new IndexedMenu("&Perspective");
		submenu.add( "&Edit Mode",			ImagineFunctions.view_persp_Edit,		true);
		submenu.add( "&Wireframe",			ImagineFunctions.view_persp_Wireframe,	true);
		submenu.add( "&Solid",				ImagineFunctions.view_persp_Solid,		true);
		submenu.add( "&Color",				ImagineFunctions.view_persp_Colour,		true);
		submenu.addSeparator();
		submenu.add( "Show &Lines",			ImagineFunctions.view_persp_Lines,		true);
		submenu.addSeparator();
		submenu.add( "Show &Blobs",			ImagineFunctions.view_persp_Blobs,		true);
		submenu.add( "Blob &Mesh Density",	ImagineFunctions.view_persp_Mesh);
		submenu.addSeparator();
		submenu.add( "Reset",				ImagineFunctions.view_persp_Reset);
		submenu.add( "Viewing &Distance",	ImagineFunctions.view_persp_Distance);
		submenu.add( "&Zoom Ratio",			ImagineFunctions.view_persp_Zoom);
		menu.add(submenu);
		
		//- - - - - - - - - - - - - - - - - - - - - - - - - -
		submenu = new IndexedMenu("&Grid");
		submenu.add( "&On/Off",				ImagineFunctions.view_grid_Onoff,			true);
		submenu.add( "Size",				ImagineFunctions.view_grid_Size);
		menu.add(submenu);
		
		//- - - - - - - - - - - - - - - - - - - - - - - - - -
		menu.add( "&Coordinates",			ImagineFunctions.view_Coordinates);
		menu.addSeparator();
		menu.add( "R&eset",					ImagineFunctions.view_Reset);
		menu.add( "&Redraw",				ImagineFunctions.view_Redraw);
		menu.add( "Rece&nter",				ImagineFunctions.view_Recenter);
		menu.add( "Zoom &In",				ImagineFunctions.view_ZoomIn);
		menu.add( "Zoom O&ut",				ImagineFunctions.view_ZoomOut);
		menu.add( "Set &Zoom",				ImagineFunctions.view_SetZoom);
		menu.addSeparator();
		
		//- - - - - - - - - - - - - - - - - - - - - - - - - -
		submenu = new IndexedMenu("Zone");
		submenu.add( "&Set",				ImagineFunctions.view_zone_Set);
		submenu.add( "&Clear",				ImagineFunctions.view_zone_Clear);
		menu.add(submenu);
		menu.addSeparator();
		
		//- - - - - - - - - - - - - - - - - - - - - - - - - -
		submenu = new IndexedMenu("&Backdrop");
		submenu.add( "&Load",				ImagineFunctions.view_backdrop_Load);
		submenu.add( "&Clear",				ImagineFunctions.view_backdrop_Clear);
		submenu.add( "&Frame",				ImagineFunctions.view_backdrop_Frame);
		menu.add(submenu);
		
		//- - - - - - - - - - - - - - - - - - - - - - - - - -
		return menu;
	}

	//-----------------------------------------------------------
	private IndexedMenu make_object_menu()
	{
		IndexedMenu menu, submenu;
		
		menu = new IndexedMenu("&Object");
		menu.add( "&Load",				ImagineFunctions.object_Load);
		menu.add( "&Save",				ImagineFunctions.object_Save);
		
		submenu = new IndexedMenu("D&XF");
		submenu.add( "Load",			ImagineFunctions.object_dxf_Load);
		submenu.add( "Save",			ImagineFunctions.object_dxf_Save);
		menu.add(submenu);

		menu.add( "Con&vert Image",		ImagineFunctions.object_Convert);
		menu.addSeparator();
		
		//- - - - - - - - - - - - - - - - - - - - - - -
		submenu = new IndexedMenu("&New");
		submenu.add( "&Axis",			ImagineFunctions.object_new_Axis);
		submenu.add( "&Ground",			ImagineFunctions.object_new_Ground);
		submenu.add( "&Sphere",			ImagineFunctions.object_new_Sphere);
		submenu.add( "&Primitive",		ImagineFunctions.object_new_Primitive);
		submenu.addSeparator();

		submenu.add( "&Open Path",		ImagineFunctions.object_new_OpenPath);
		submenu.add( "&Closed Path",	ImagineFunctions.object_new_ClosedPath);
		submenu.addSeparator();
		
		submenu.add( "&Deform Tool",	ImagineFunctions.object_new_Deform);

		menu.add(submenu);

		//- - - - - - - - - - - - - - - - - - - - - - -
		menu.add( "&Delete",			ImagineFunctions.object_Delete);
		menu.addSeparator();
		
		menu.add( "C&ut",				ImagineFunctions.object_Cut);
		menu.add( "&Copy",				ImagineFunctions.object_Copy);
		menu.add( "&Paste",				ImagineFunctions.object_Paste);
		menu.addSeparator();
		
		menu.add( "Chec&k Object",		ImagineFunctions.object_CheckObject);
		menu.addSeparator();
		
		menu.add( "&Transformation",	ImagineFunctions.object_Transformation);
		
		menu.add( "&Join",				ImagineFunctions.object_Join);
		menu.add( "&Merge",				ImagineFunctions.object_Merge);
		menu.add( "S&kin",				ImagineFunctions.object_Skin);
		menu.add( "Sl&ice",				ImagineFunctions.object_Slice);
		menu.add( "&Fracture",			ImagineFunctions.object_Fracture);
		menu.add( "S&plit",				ImagineFunctions.object_Split);
		menu.add( "Mesh &Blobs",		ImagineFunctions.object_MeshBlobs);
		menu.add( "M&ake Path",			ImagineFunctions.object_MakePath);
		menu.add( "Make Closed Pat&h",	ImagineFunctions.object_MakeClosedPath);
		
		return menu;
	}

	//-----------------------------------------------------------
	private IndexedMenu make_mode_menu()
	{
		IndexedMenu menu,submenu;
		
		menu = new IndexedMenu("&Mode");
		
		//- - - - - - - - - - - - - - - - - - - - - - - - - 
		submenu = new IndexedMenu("&Pick");
		submenu.add( "&Groups",			ImagineFunctions.mode_pick_Groups,	true);
		submenu.add( "&Objects",		ImagineFunctions.mode_pick_Objects,	true);
		submenu.add( "&Faces",			ImagineFunctions.mode_pick_Faces,	true);
		submenu.add( "&Edges",			ImagineFunctions.mode_pick_Edges,	true);
		submenu.add( "&Points",			ImagineFunctions.mode_pick_Points,	true);
		menu.add(submenu);
		
		//- - - - - - - - - - - - - - - - - - - - - - - - - 
		submenu = new IndexedMenu("&Add");
		submenu.add( "&Faces",			ImagineFunctions.mode_add_Faces);
		submenu.add( "&Edges",			ImagineFunctions.mode_add_Edges);
		submenu.add( "&Points",			ImagineFunctions.mode_add_Points);
		submenu.add( "&Lines",			ImagineFunctions.mode_add_Lines);
		menu.add(submenu);
		
		//- - - - - - - - - - - - - - - - - - - - - - - - - 
		menu.add( "&Drag Points",		ImagineFunctions.mode_DragPoints);
		menu.add( "&Hide points",		ImagineFunctions.mode_HidePoints);
		menu.add( "Edit &Path",			ImagineFunctions.mode_EditPath);
		menu.addSeparator();
		
		//- - - - - - - - - - - - - - - - - - - - - - - - - 
		submenu = new IndexedMenu("Mag&netism");
		submenu.add( "&On/Off",			ImagineFunctions.mode_magn_OnOff,	 true);
		submenu.add( "&Setup",			ImagineFunctions.mode_magn_Setup);
		menu.add(submenu);
		
		//- - - - - - - - - - - - - - - - - - - - - - - - - 
		submenu = new IndexedMenu("Pick &Method");
		submenu.add( "&Click",			ImagineFunctions.mode_method_Click	,true);
		submenu.add( "&Drag Box",		ImagineFunctions.mode_method_DragBox,true);
		submenu.add( "&Lassoo",			ImagineFunctions.mode_method_Lassoo	,true);
		menu.add(submenu);
		menu.addSeparator();
		
		//- - - - - - - - - - - - - - - - - - - - - - - - - 
		menu.add( "&Grid Snap",			ImagineFunctions.mode_GridSnap);
		menu.addSeparator();
		
		//- - - - - - - - - - - - - - - - - - - - - - - - - 
		menu.add( "Quickdraw All",		ImagineFunctions.mode_QuickdrawAll);
		menu.add( "Quickdraw T&oggle",	ImagineFunctions.mode_QuickdrawToggle);
		menu.add( "Quickdraw &None",	ImagineFunctions.mode_QuickdrawNone);
		
		return menu;
	}

	//-----------------------------------------------------------
	private IndexedMenu make_functions_menu()
	{
		IndexedMenu menu, submenu;
		
		menu = new IndexedMenu("&Functions");
		menu.add( "&Attributes",			ImagineFunctions.func_Attributes);
		menu.add( "Appl&y Attributes",		ImagineFunctions.func_ApplyAttributes);
		menu.add( "&Blob Attributes",		ImagineFunctions.func_BlobAttributes);
		menu.add( "&Particles",				ImagineFunctions.func_Particles);
		menu.add( "&Face Colors",			ImagineFunctions.func_FaceColors);
		menu.add( "Randomi&ze Face colors",	ImagineFunctions.func_RandomizeFaceColors);
		menu.addSeparator();
		
		//- - - - - - - - - - - - - - - - - - 
		submenu = new IndexedMenu("Ma&ke");
		submenu.add( "Make Sharp Edges",	ImagineFunctions.func_make_SharpEdges);
		submenu.add( "Make Soft Edges",		ImagineFunctions.func_make_SoftEdges);
		submenu.add( "Make &Quick Edges",	ImagineFunctions.func_make_QuickEdges);
		submenu.add( "&Unmake quick edges",	ImagineFunctions.func_make_UnmakeQuickEdges);
		submenu.add( "Make Subgroup",		ImagineFunctions.func_make_Subgroup);
		submenu.add( "Unmake Subgroup",		ImagineFunctions.func_make_UnmakeSubgroup);
		submenu.add( "Make Big Bone Subgroup",		ImagineFunctions.func_make_BigBoneSubgroup);
		submenu.add( "Make Small Bones Subgroup",	ImagineFunctions.func_make_SmallBonesSubgroup);
		menu.add(submenu);
		menu.addSeparator();
		
		//- - - - - - - - - - - - - - - - - - 
		submenu = new IndexedMenu("&Mold");
		submenu.add( "&Extrude",			ImagineFunctions.func_mold_Extrude);
		submenu.add( "&Replicate",			ImagineFunctions.func_mold_Replicate);
		submenu.add( "&Spin",				ImagineFunctions.func_mold_Spin);
		submenu.add( "S&weep",				ImagineFunctions.func_mold_Sweep);
		menu.add(submenu);
		
		//- - - - - - - - - - - - - - - - - - 
		submenu = new IndexedMenu("&Deformations");
		submenu.add( "&Stretch",			ImagineFunctions.func_deform_Stretch);
		submenu.add( "&Twist",				ImagineFunctions.func_deform_Twist);
		submenu.add( "&Pinch",				ImagineFunctions.func_deform_Pinch);
		submenu.add( "T&aper",				ImagineFunctions.func_deform_Taper);
		submenu.add( "&Bend",				ImagineFunctions.func_deform_Bend);
		submenu.add( "S&hear",				ImagineFunctions.func_deform_Shear);
		menu.add(submenu);
		
		//- - - - - - - - - - - - - - - - - - 
		submenu = new IndexedMenu("&Conformations");
		submenu.add( "To &Sphere",			ImagineFunctions.func_conform_Sphere);
		submenu.add( "To &Cylinder",		ImagineFunctions.func_conform_Cylinder);
		submenu.add( "To &Path",			ImagineFunctions.func_conform_Path);
		menu.add(submenu);
		
		menu.add( "&Wave",					ImagineFunctions.func_Wave);
		menu.add( "&Latticize",				ImagineFunctions.func_Latticize);
		menu.add( "De&form Tool",			ImagineFunctions.func_Deform);
		menu.add( "&Smoothing Tool",		ImagineFunctions.func_Smoothing);
		menu.add( "Appliq&ue",				ImagineFunctions.func_Applique);
		menu.add( "Apply Stage F/&X",		ImagineFunctions.func_StageFX);
		menu.addSeparator();
		
		menu.add( "Snap to &Grid",			ImagineFunctions.func_SnapToGrid);
		menu.add( "&Taut",					ImagineFunctions.func_Taut);
		menu.addSeparator();
		
		menu.add( "Set &Edge Line",			ImagineFunctions.func_SetEdgeLine);
		menu.add( "F&ill to Edge Line",		ImagineFunctions.func_FillToEdgeLine);
		menu.add( "Smoot&h Edge Line",		ImagineFunctions.func_SmoothEdgeLine);
		menu.add( "Smooth &Fracture",		ImagineFunctions.func_SmoothFracture);
		
		return menu;
	}

	//-----------------------------------------------------------
	private IndexedMenu make_pick_menu()
	{
		IndexedMenu menu;

		menu = new IndexedMenu("&Pick");
		menu.add( "Pick &All",			ImagineFunctions.pick_PickAll);
		menu.addSeparator();
		
		menu.add( "&Highlight First",	ImagineFunctions.pick_HighlightFirst);
		menu.add( "Highlight &Next",	ImagineFunctions.pick_HighlightNext);
		menu.add( "Highlight &Prev",	ImagineFunctions.pick_HighlightPrev);
		menu.addSeparator();
		
		menu.add( "P&ick Highlighted",	ImagineFunctions.pick_PickHighlighted);
		menu.add( "Unpick Highlighted",	ImagineFunctions.pick_UnpickHighlighted);
		menu.add( "Unpick &Last Picked",ImagineFunctions.pick_UnpickLastPicked);
		menu.addSeparator();
		
		menu.add( "&Sort",				ImagineFunctions.pick_Sort);
		menu.add( "&Find",				ImagineFunctions.pick_Find);
		menu.addSeparator();
		
		menu.add( "Pick Sub&group",		ImagineFunctions.pick_PickSubgroup);
		menu.add( "Unpick Su&bgroup",	ImagineFunctions.pick_UnpickSubgroup);
		menu.addSeparator();
		
		menu.add( "Pic&k Range",		ImagineFunctions.pick_PickRange);
		menu.add( "Unpi&ck Range",		ImagineFunctions.pick_UnpickRange);
		menu.addSeparator();
		
		menu.add( "&Edge Filter",		ImagineFunctions.pick_EdgeFilter);
		menu.add( "Pick Sharp Edges",	ImagineFunctions.pick_PickSharpEdges);
		menu.addSeparator();
		
		menu.add( "Pick Mo&re",			ImagineFunctions.pick_PickMore);
		menu.add( "Hi&de Unpicked",		ImagineFunctions.pick_HideUnpicked);
		menu.add( "Unhide A&ll",		ImagineFunctions.pick_UnhideAll);
		menu.add( "Unhide Subgr&oup",	ImagineFunctions.pick_UnhideSubgroup);
		
		return menu;
	}

	//-----------------------------------------------------------
	private IndexedMenu make_states_menu()
	{
		IndexedMenu menu, submenu;
		
		menu = new IndexedMenu("&States");
		
		//- - - - - - - - - - - - - - - - - - - - - - - - - - -
		submenu = new IndexedMenu("&States");
		submenu.add( "&Set To",			ImagineFunctions.states_states_SetTo);
		submenu.add( "&Tween To",		ImagineFunctions.states_states_TweenTo);
		submenu.add( "&Create",			ImagineFunctions.states_states_Create);
		submenu.add( "C&lone",			ImagineFunctions.states_states_Clone);
		submenu.add( "&Update",			ImagineFunctions.states_states_Update);
		submenu.add( "&Delete",			ImagineFunctions.states_states_Delete);
		submenu.add( "&Info",			ImagineFunctions.states_states_Info);
		submenu.add( "I&mport",			ImagineFunctions.states_states_Import);
		submenu.add( "&Animate",		ImagineFunctions.states_states_Animate);
		menu.add(submenu);
		menu.addSeparator();

		//- - - - - - - - - - -	- - - - - - - - - - - - - - - -
		menu.add( "&Group",				ImagineFunctions.states_Group);
		menu.add( "&Ungroup",			ImagineFunctions.states_Ungroup);
		menu.add( "Cascade Grou&p",		ImagineFunctions.states_CascadeGroup);
		menu.add( "&Hook",				ImagineFunctions.states_Hook);
		menu.add( "U&nhook",			ImagineFunctions.states_Unhook);
		menu.addSeparator();
		
		menu.add( "&Freeze",			ImagineFunctions.states_Freeze);
		menu.add( "&Release",			ImagineFunctions.states_Release);
		menu.add( "Release &All",		ImagineFunctions.states_ReleaseAll);
		menu.add( "&Constrain",			ImagineFunctions.states_Constrain);
		menu.addSeparator();
		
		menu.add( "&Bone Subgroups",	ImagineFunctions.states_BoneSubgroups);
		menu.add( "Bones Up&date",		ImagineFunctions.states_BonesUpdate);
		menu.addSeparator();
		
		menu.add( "S&trip object",		ImagineFunctions.states_StripObject);
		
		return menu;
	}

	//-----------------------------------------------------------
	private IndexedMenu make_about_menu()
	{
		IndexedMenu menu;
		
		menu = new IndexedMenu("&About");
		menu.add( "About Imagine...",	ImagineFunctions.about_Imagine);
		return menu;
	}
	
	
	//**********************************************************
	//				EXECUTING
	//**********************************************************
	private void perform_function( int ID, Object obj)
	{
		switch (ID)
		{
			case ImagineFunctions.about_Imagine:
				//dlg = new InfoDialog ( 
				//		this,
				//		"About WebImagine",
				//		"WebImagine Version IFWEB0.0\n" +
				//		"Copyright (c) 1997\n" +
				//		"sunil@magnetic.demon.co.uk\n\n" +
				//		"Imagine is a trademark and copyright of Impulse Inc.");
				//dlg.show();
				break;
				
			case ImagineFunctions.edit_Exit:
				this.hide();
				this.dispose();
				return;
		}
	}
	
	//**********************************************************
	//				TESTING CODE
	//**********************************************************
	public static void main ( String argv[])
	{
		ImagineFrame frame;
		
		frame = new ImagineFrame();
		frame.show();
		frame.resize(500,400);
	}

}

file: /Techref/language/JAVA/nosugar/custom/imagine/code/ImagineFrame.java, 19KB, , updated: 1997/1/15 00:31, local time: 2024/12/24 08:20,
TOP NEW HELP FIND: 
18.119.133.214:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.ecomorder.com/Techref/language/JAVA/nosugar/custom/imagine/code/ImagineFrame.java"> language JAVA nosugar custom imagine code ImagineFrame</A>

Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to massmind.ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .