//***************************************************************************** // 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_27 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_27.java,v $ $revision$ $Date: 1998/11/02 15:55:55 $ Copyright 1998 INRIA."; protected final void initTutorial() { setLayout(new GridLayout(1,1)); _facade = new AWTFacade(getParameters()); add(_facade.getAwtComponent()); setDefaultKeyListener(_facade); initResources(); buildBox(); } public final void destroy() { _facade.disposeWhenInactive(); _facade = null; _greekFont = null; _yellow = null; _blue = null; super.destroy(); } private final void initResources() { try { _greekFont = _facade.doGetFont(null,FontFamily.SYMBOL,FontStyle.BOLD,24,false); _facade.doGetColor("red",BasicColor.RED); _yellow = _facade.doGetColor("yellow",BasicColor.YELLOW); _blue = _facade.doGetColor(null,0,0,255); } catch ( WrongResourceException anException ) { ; } initStandardResources(_facade); } private final void buildBox() { try { final GlyphInterface theFirstContext = new ChangeGraphicalContextAnonymous(_greekFont,_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(null,_facade.getColor("red"),_yellow); theLine.addChild(theSecondContext); theSecondContext.addChild(Atom.newAtom("wonderful")); theLine.addChild(Atom.newAtom("life")); theLine.addChild(Atom.newAtom("!!")); PathInterface thePath = new Path(); thePath.addOperation(new InsertGlyph(theFirstContext,0)); _facade.buildInit(thePath); _facade.buildComplete(); } catch ( WrongResourceException anException ) { ; } } private final FacadeInitializer getParameters() { FacadeInitializer theParameters = new FacadeInitializer(); setAppletParameters(theParameters); return theParameters; } private AWTFacade _facade; private FontInterface _greekFont; private ColorInterface _yellow; private ColorInterface _blue; }