//***************************************************************************** // Copyright (c) 1998 INRIA. // http://www.inria.fr/croap/aioli/modules/figue/web/credits.html#COPYRIGHT //***************************************************************************** package figue.tutorial; import java.awt.GridLayout; import figue.*; import figue.box.*; import figue.path.*; import figue.resource.*; public final class Tutorial_4 extends TutorialApplet { /** * For code identification with unix what command. * @level internal */ public final static String VERSION_ID = "@(#) $Source: /net/croap/CVSROOT/figue/java/tutorial/Tutorial_4.java,v $ $revision$ $Date: 1998/11/02 15:55:59 $ Copyright 1998 INRIA."; protected final void initTutorial() { setLayout(new GridLayout(1,1)); _facade = new AWTFacade(getParameters()); add(_facade.getAwtComponent()); setDefaultKeyListener(_facade); final GlyphInterface theBox = buildBox(); initResources(); PathInterface thePath = new Path(); thePath.addOperation(new InsertGlyph(theBox,0)); _facade.buildInit(thePath); _facade.buildComplete(); } public final void destroy() { _facade.disposeWhenInactive(); _facade = null; super.destroy(); } private final GlyphInterface buildBox() { final GlyphInterface theFirstContext = new ChangeGraphicalContextAnonymous("italic","blue",null); final GlyphInterface theLine = new Horizontal(10); theFirstContext.addChild(theLine); theLine.addChild(Atom.newAtom("It's")); theLine.addChild(Atom.newAtom('a')); final GlyphInterface theSecondContext = new ChangeGraphicalContextAnonymous("big font","red","yellow"); theLine.addChild(theSecondContext); theSecondContext.addChild(Atom.newAtom("wonderful")); theLine.addChild(Atom.newAtom("life")); theLine.addChild(Atom.newAtom("!!")); return theFirstContext; } private final void initResources() { try { _facade.doGetFont("italic",FontFamily.TIMES_ROMAN,FontStyle.BOLD_ITALIC,24,false); _facade.doGetFont("big font",FontFamily.COURIER,FontStyle.BOLD,46,false); _facade.doGetColor("red",BasicColor.RED); _facade.doGetColor("yellow",BasicColor.YELLOW); _facade.doGetColor("blue",BasicColor.BLUE); } catch ( WrongResourceException anException ) { ; } initStandardResources(_facade); } private final FacadeInitializer getParameters() { FacadeInitializer theParameters = new FacadeInitializer(); setAppletParameters(theParameters); return theParameters; } private AWTFacade _facade; }