AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YDAT | YWAIT | Byzgraf | FAQs
new grammar
 
Creates a new instance of an object. Its usage description can be summarized as follows:
UnaryExpression:
	new Dvalue InitializerOPT
 
 Example:   The following example uses new in various ways to create a Frame with a single Button that will pop-up a new Frame, randomly positioned, each time it is pressed. The new frames each contain a button for exiting the program.
import yoix.math.*;

Frame f;

f.size = new Dimension { int width = 100, height = 50; };
f.layout = new Array {
    new Button {
	String text = "Pop Up";

	actionPerformed(e) {
	    new Frame {
		Point location = {
		    int x = 500 * random();
		    int y = 500 * random();
		};
		Dimension size = {
		    int height = 50;
		    int width = 50;
		};
		Array layout = {
		    new Button {
			String text = "Exit";

			actionPerformed(e) {
			    exit(0);
			}
		    }
		};

		int visible = 1;
	    };
	};
    }
};

f.visible = true;
 
 See Also:   reference

 

Yoix is a registered trademark of AT&T Intellectual Property.