How to use mjbModel in your own program

I have split the classes which make up the program into two packages (in java terminology) or address spaces (in C# terminology), these are:

The reason for this split is to allow other programmers to use the model in their own program, so that they can write their own user interface without having to write an entire 3D modelling program.

What I would like to do is every time I release a new version of the complete program would be to also release a separate mjbModel JAR file in parallel. Unfortunately I seem to be overstreaching myself and I have not managed to do this since version 5.15 (which is the last version to support Java3D, newer versions use JOGL). So if you want to do this you will need to download the source files and compile only the mjbModel files (which are in a separate directory) together with the JOGL stuff and other resources into a JAR. I think it would also be a good idea to run JavaDoc on this so that you can work out which methods to call.

The Java version of mjbModel uses beans standards with the intention of allowing your Java IDE to allow you to select the classes you need to use at build time.

The following is a quick guide that I wrote for using the Java3D version, this is out of date but it may still help you.

Create your own application or applet, then to add a 3d window using the mjbModel bean do the following:

1) import the model

Insert the following line at the top of your file:

import mjbModel.*;

2) create the model

public mjbModel model = new mjbModel();

3) initialise and add to panel

model.initialise(this); // 'this' must be instance of mjbModel.modelEvent interface


4) implement modelEvent interface

put interface mjbModel.modelEvent in your class definition and implement the following classes:

public void statusMessage(String s){

public String getFileName(){
return currFileName;

public nodeBean getSelected() {
return selected;

public void setSelected(nodeBean s) {
selected = s;

5) to load a file

filter_base f=new filter_base();

6) to save a file

filter_base f=new filter_base();


7 )Starting the renderer and setting the view

model.setView(1,0,(TransformGroup)tg); // front view

8) Changing the tool

model.setTool(rootBean.TOOL_DRAG); //drag tool

9) Adding an object to under the currently selected object



metadata block
see also:

3D theory - Physics

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.


Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to this site, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.


This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2018 Martin John Baker - All rights reserved - privacy policy.