//***************************************************************************** // 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_26 extends TutorialSwingApplet { /** * For code identification with unix what command. * @level internal */ public final static String VERSION_ID = "@(#) $Source: /net/croap/CVSROOT/figue/java/tutorial/Tutorial_26.java,v $ $revision$ $Date: 1998/11/02 15:55:55 $ Copyright 1998 INRIA."; protected final void initTutorial() { getContentPane().setLayout(new GridLayout(1,1)); FacadeInitializer theParameters = getParameters(); theParameters.setFormattingWidth(600); _facade = new SWINGFacade(theParameters); setDefaultKeyListener(_facade); getContentPane().add(_facade.getAwtComponent()); validate(); initResources(_facade); buildBox(_facade); } public final void destroy() { _facade.disposeWhenInactive(); _facade = null; super.destroy(); } private final void buildBox(FacadeInterface aFacade) { final GlyphInterface theParagraph = new Paragraph(10,0,15); for ( int theRank = 0; theRank < 35; theRank++ ) { pushWords(theParagraph); } PathInterface thePath = new Path(); thePath.addOperation(new InsertGlyph(theParagraph,0)); aFacade.buildInit(thePath); aFacade.buildComplete(); } private final void pushWords(GlyphInterface aGlyph) { aGlyph.addChild(Atom.newAtom("It's")); aGlyph.addChild(Atom.newAtom("a")); aGlyph.addChild(Atom.newAtom("wonderful","style hot")); aGlyph.addChild(Atom.newAtom("life")); aGlyph.addChild(Atom.newAtom("!!","style hot")); } private final void initResources(FacadeInterface aFacade) { try { aFacade.doGetFont(Constants.DEFAULT_FONT,FontFamily.TIMES_ROMAN,FontStyle.PLAIN,15,false); aFacade.doGetColor(Constants.DEFAULT_COLOR,BasicColor.BLUE); aFacade.doGetColor(Constants.DEFAULT_BACKGROUND,BasicColor.WHITE); aFacade.doGetFont("big font",FontFamily.COURIER,FontStyle.BOLD,20,false); aFacade.doGetColor("yellow",BasicColor.YELLOW); aFacade.doGetColor("red",BasicColor.RED); aFacade.doGetStyle("style hot", aFacade.getFont("big font"), aFacade.getColor("red"), aFacade.getColor("yellow")); } catch ( WrongResourceException anException ) { ; } initStandardResources(aFacade); } private final FacadeInitializer getParameters() { FacadeInitializer theParameters = new FacadeInitializer(); setAppletParameters(theParameters); return theParameters; } private SWINGFacade _facade; }