//***************************************************************************** // 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_3 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_3.java,v $ $revision$ $Date: 1998/11/02 15:55:56 $ 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; _italicFont = null; _yellow = null; _blue = null; super.destroy(); } private final void initResources() { try { _italicFont = _facade.doGetFont(null,FontFamily.TIMES_ROMAN,FontStyle.BOLD_ITALIC,24,false); _facade.doGetFont("big font",FontFamily.COURIER,FontStyle.BOLD,46,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(_italicFont,_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(_facade.getFont("big font"),_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 _italicFont; private ColorInterface _yellow; private ColorInterface _blue; }