HyperView2.959 bannerDocumentation
 
To utilize HyperView you extend it.

I use a file called "ViewMain.class" and overwrite the HyperView.class boolean main() method.
You could call it whatever you like. For these demos I will callit ViewMain1, ViewMain2,ViewMain3 etc.

When the View starts and is at the initial display stack frame it will call the main() method.
The main() method MUST do its setup and promptly exit. Within the main method you have the display
locked (Have obtained the requisite Monitors) and at that instant can change any of the View class variables
witout regard to synchronization.

A simple Hello World example. This will add the DBText to the HyperView text display block.
Hello World example.
(Applet not yet implemented)
To see HyperView running see the main example page

 



The code for this example:

public class ViewMain extends HyperView   // We declared a ViewMain and save this as "ViewMain.java"
{
public synchronized boolean main()
{
DBText dbText = new DBText(" Hello World!",100,100); // Print "Hello World at pixel location X100 Y100
return true;
}
}


Another example.   Creating a button


public class ViewMain extends HyperView
{
public synchronized boolean main()
{
Gadget myGadget = new Gadget(" Click Me! ",100,100); // Print "Hello World at pixel location X100 Y100
return true;
}
}

Now lets create a button and add a Dispatch.class object to it.
When a mouse event is received on this Container, the HyperView will either called the Dispatch.run()


public class ViewMain extends HyperView
{
public synchronized boolean main()
{
DBText dbText = new DBText(" Hello World!",100,100); // Print "Hello World at pixel location X100 Y100
return true;
}
// This is the inner Dispatch.class Its run method will be called when the
// Gadget
 
class ViewDispatch extends Dispatch
{
ViewDispatch(HyperView tView)
{
super(tView);
}

public boolean run()
{
System.out.println("You clicked me!");
return true; // else if flase is returned the View will abort the stack frame
}
}

// Now when you click on the button you will see the String "You clicked me!"
// echoed in stdout.







A Gob example:
//-------- This Gob is created from this 46 X 47 file 46 X 47 imagethis example will move along the Spline
// X/Y/Z and when it reaches the end will bounce and return backwards.

//Note: save this as "ViewMain.java"

public class ViewMain extends HyperView
{
int xLocs0[] = {300,224,575,100,10,200}; // First create X/Y location ints.
int yLocs0[] = {200,170,425,400,20,300};
int zLocs0[] = {1 ,25,1 ,10, 1,6}; // Create some ints for Z location

public boolean main()
{
// ********* Make a Spline
// "this" = HyperView.class;(ViewMain.class inherits from HyperView.class)
// |
Velocity X/Y points Flag Bits
Spline spline0 = new Spline(this,1, xLocs0,yLocs0,zLocs0, BOUNCE_AT_END);

// Make the Gob and add
spline0 Spline to it.
Gob myGob = new Gob(this,"ea2.gif",46,47,spline0,GOB_ON_DISPLAY|BOUNCE_AT_END);
// All Gobs MUST be >> enabled << to be rendered in the display.
myGob.gobFlags |= GOB_ON_DISPLAY;
return true
}
}