//***************************************************************************** // 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.resource.*; import figue.path.*; public final class Tutorial_20 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_20.java,v $ $revision$ $Date: 1998/11/02 15:55:53 $ 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; super.destroy(); } private final void buildBox() { final GlyphInterface theColumn = new Vertical(0,0); theColumn.addChild(Atom.newAtom("Space before " + BEFORE)); final GlyphInterface theLine = new Horizontal(0); theColumn.addChild(theLine); theLine.addChild(Atom.newAtom("Space to left " + LEFT)); final GlyphInterface theInsets = new Insets(BEFORE,AFTER,LEFT,RIGHT); final GlyphInterface theContext = new ChangeGraphicalContextAnonymous("italic","green","yellow"); theInsets.addChild(theContext); final GlyphInterface theOtherLine = new Horizontal(5); theContext.addChild(theOtherLine); theOtherLine.addChild(Atom.newAtom("It's")); theOtherLine.addChild(Atom.newAtom("a")); theOtherLine.addChild(Atom.newAtom("Wonderful")); theOtherLine.addChild(Atom.newAtom("Life")); theOtherLine.addChild(Atom.newAtom("!!")); theLine.addChild(theInsets); theLine.addChild(Atom.newAtom("Space to right " + RIGHT)); theColumn.addChild(Atom.newAtom("Space after " + AFTER)); PathInterface thePath = new Path(); thePath.addOperation(new InsertGlyph(theColumn,0)); _facade.buildInit(thePath); _facade.buildComplete(); } private final void initResources() { try { _facade.doGetFont(Constants.DEFAULT_FONT,FontFamily.TIMES_ROMAN,FontStyle.PLAIN,15,false); _facade.doGetColor(Constants.DEFAULT_COLOR,BasicColor.BLUE); _facade.doGetColor(Constants.DEFAULT_BACKGROUND,BasicColor.WHITE); _facade.doGetFont("italic",FontFamily.TIMES_ROMAN,FontStyle.BOLD_ITALIC,18,false); _facade.doGetFont("big",FontFamily.TIMES_ROMAN,FontStyle.BOLD,46,false); _facade.doGetColor("yellow",BasicColor.YELLOW); _facade.doGetColor("blue",BasicColor.BLUE); _facade.doGetColor("red",BasicColor.RED); _facade.doGetColor("green",BasicColor.GREEN); } catch ( WrongResourceException anException ) { ; } initStandardResources(_facade); } private final FacadeInitializer getParameters() { FacadeInitializer theParameters = new FacadeInitializer(); theParameters.setFormattingWidth(1900); setAppletParameters(theParameters); return theParameters; } private AWTFacade _facade; private final static int BEFORE = 60; private final static int AFTER = 30; private final static int LEFT = 10; private final static int RIGHT = 20; }