package jhpro.engine3d;
import java.awt.*;
import java.awt.event.*;
/*
This is a proprietary part of jHepWork package.
License: the Creative Commons Attribution-Share Alike License; either version 3.0 of the License,
or any later version.
http://creativecommons.org/licenses/by-sa/3.0/
Permission to use, copy and modify this software and its documentation for
NON-COMMERCIAL purposes is granted,
without fee, provided that an acknowledgement to the author, Dr Sergei Chekanov
appears in all copies and associated documentation or publications.
Redistributions of the source code, or parts of the source codes,
must retain the copyright notice, this list of conditions and the following disclaimer
(all at the top of each source code) and requires the written permission of Sergei Chekanov
Redistribution in binary form of all or parts of a class must reproduce the
copyright notice, this list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution and requires the written permission of Sergei Chekanov
Details about license agreement or commercial use are: http://jwork.org/jhepwork/license.php
*/
public class HEngine3D extends Frame implements ActionListener {
private ViewPanel3d myframe;
/**
*
*/
private static final long serialVersionUID = 1L;
public HEngine3D(String model) { // constructor
super("Hold Applet with Menu"); // define frame title
// define Menubar
MenuBar mb = new MenuBar();
setMenuBar(mb);
// Define File menu and with Exit menu item
Menu fileMenu = new Menu("File");
mb.add(fileMenu);
MenuItem exitMenuItem = new MenuItem("Exit");
fileMenu.add(exitMenuItem);
exitMenuItem.addActionListener (this);
// define the applet and add to the frame
myframe = new ViewPanel3d(model);
add(myframe, BorderLayout.CENTER);
} // end constructor
/**
* Get View panel
* @return
*/
public Window3d getView(){
return myframe.getPad3D();
}
/**
* Get Object3D
* @return
*/
public FacetedObject getObject3D(){
return myframe.getObject3D();
}
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() instanceof MenuItem) {
String menuLabel = ((MenuItem)evt.getSource()).getLabel();
if(menuLabel.equals("Exit")) {
// close application, when exit is selected
setVisible(false);
dispose();
// System.exit(0);
} // end if
} // end if
} // end ActionPerformed
} // end class
Ads help maintain this website.