<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package devASD.templateProject;

import java.applet.Applet;
import java.awt.*;

import jv.object.PsMainFrame;
import jv.object.PsViewerIf;
import jv.viewer.PvViewer;

/**
 * Here is a template you may use to create your own project with JavaView.
 * You just have to change a few lines according to your project name and goal.
 * These lines are highlighted with this comment : //TODO To modify : [Explanation of what to modify]
 * 
 * You are of course supposed to modify all the comments according to the JavaDoc rules to explain
 * what each elements of this file is for.
 * 
 * JavaView project architecture:
 * A JavaView project is composed of at least three core class : Pa[Project name], Pj[Project name]
 * and Pj[Project name]_IP.
 *  - Pa[Project name] : This is the main class. It should has main, and start the whole thing using
 *  this 2 others core class. Here you just have to adjust details from this template
 *  - Pj[Project name] : This class contains the main fields : geometry and settings.
 *  It also contains the main methods, which define what the project does, and also the methods
 *  called when the user changes something (by the IP class).
 *  - Pj[Project name]_IP : This class contains all the panel things (buttons, checkboxes, ...) except the
 *  sliders (for the sliders see the corresponding page on the Wiki). This class should also explain 
 *  deeply what does your project do and how to use the control panel. This class should contain the
 *  ActionHandler, which calls public method from Pj[Project name]. 
 *  IP means InfoPanel. 
 * 
 * @see			jv.viewer.PvViewer
 * @author		you
 * @version		now, 1.00 created (ms)
 */
public class PaTemplateProject extends Applet { //TODO To modify : Name
	/**
	 * If variable m_frame!=null then this applet runs in an application,
	 * otherwise applet runs inside an Html page within a browser.
	 * Further, when running as application then this frame is the container
	 * of the applet.
	 */
	public		Frame				m_frame			= null;
	/**
	 * 3D-viewer window for graphics output, display is embedded into the applet.
	 * This instance variable allows JavaView to perform start, stop and destroy
	 * operations when the corresponding methods of this applet are called,
	 * for example, by a browser.
	 */
	protected	PvViewer			m_viewer;

	/**
	 * Configure and initialize the viewer, load system and user projects.
	 * One of the user projects must be selected here.
	 */
	public void init() {
		// Create viewer for viewing 3d geometries. References to the applet and frame
		// allow JavaView to decide whether program runs as applet or standalone application,
		// and, in the later case, it allows to use the frame as parent frame.
		m_viewer = new PvViewer(this, m_frame);

		// Create and load a project which contains the user application. Putting code
		// in a JavaView project allows to reuse the project in other applications.
		
		//TODO To modify : name
		PjTemplateProject myProject = new PjTemplateProject(); 
		
		m_viewer.addProject(myProject);
		m_viewer.selectProject(myProject);
		
		//Show Project Inspector right at start up
		m_viewer.showPanel(PsViewerIf.PROJECT);
		m_viewer.showDialog(PsViewerIf.CONTROL);

		setLayout(new BorderLayout());
		// Get 3d display from viewer and add it to applet
		add(m_viewer.getDisplay().getCanvas(), BorderLayout.CENTER);
	}
	
	/**
	 * Standalone application support. The main() method acts as the applet's
	 * entry point when it is run as a standalone application. It is ignored
	 * if the applet is run from within an HTML page.
	 */
	public static void main(String args[]) {
		PaTemplateProject app	= new PaTemplateProject();
		// Create toplevel window of application containing the applet
		PsMainFrame frame	= new jv.object.PsMainFrame(app, args);
		frame.pack();
		// Store the variable frame inside the applet to indicate
		// that this applet runs as application.
		app.m_frame = frame;
		app.init();
		// In application mode, explicitly call the applet.start() method.
		app.start();
		
		
		//TODO To modify : Be careful that the Control Panel and the Display Panel don´t overlap.
		//The size and position of the Control Panel is defined in PjTemplateProject_IP
		Point framePosition	= new Point(375, 5); //Position of the Display Panel
		Dimension frameSize	= new Dimension(800, 800); //Size of the Display Panel
		
		
		frame.setInnerBounds(new Rectangle(framePosition, frameSize));
		frame.setVisible(true);
		frame.toFront();
	}
	
	/**
	 * Does clean-up when applet is destroyed by the browser.
	 * Here we just close and dispose all our control windows.
	 */
	public void destroy()	{ m_viewer.destroy(); }

	/** Start viewer, e.g. start animation if requested */
	public void start()		{ m_viewer.start(); }

	/** Stop viewer, e.g. stop animation if requested */
	public void stop()		{ m_viewer.stop(); }
}
</pre></body></html>