//***************************************************************************** // Copyright (c) 1998 INRIA. // http://www.inria.fr/croap/aioli/modules/figue/web/credits.html#COPYRIGHT //***************************************************************************** package figue.tutorial; import java.awt.BorderLayout; import java.awt.Frame; import java.awt.Button; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.Panel; import java.awt.FlowLayout; import figue.*; import figue.box.*; import figue.path.*; public final class Tutorial_16 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_16.java,v $ $revision$ $Date: 1998/11/02 15:55:51 $ Copyright 1998 INRIA."; protected final void initTutorial() { _application = new Frame(); _application.setTitle("Hello World Demo"); final int theWidth = 300; final int theHeight = 150; final java.awt.Dimension theScreenSize = getToolkit().getScreenSize(); final int theScreenWidth = theScreenSize.width; final int theScreenHeight = theScreenSize.height; _application.setBounds(((theWidth + theScreenWidth) / 2) - theWidth, ((theHeight + theScreenHeight) / 2) - theHeight, theWidth,theHeight); _application.setLayout(new BorderLayout()); final Panel thePanel = new Panel(); thePanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,5)); Button theButton = new Button("Close"); thePanel.add(theButton); _application.add(BorderLayout.SOUTH,thePanel); theButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent anEvent) { _application.dispose(); _application = null; } }); _facade = new AWTFacade(getParameters()); _application.add(BorderLayout.CENTER,_facade.getAwtComponent()); setDefaultKeyListener(_facade); validate(); _application.setVisible(true); _application.toFront(); initResources(); buildBox(); } public final void destroy() { _facade.disposeWhenInactive(); _facade = null; if ( _application != null ) { _application.dispose(); _application = null; } super.destroy(); } private final void buildBox() { final GlyphInterface theMessage = Atom.newAtom("Hello World"); PathInterface thePath = new Path(); thePath.addOperation(new InsertGlyph(theMessage,0)); _facade.buildInit(thePath); _facade.buildComplete(); } private final FacadeInitializer getParameters() { FacadeInitializer theParameters = new FacadeInitializer(); setAppletParameters(theParameters); return theParameters; } private final void initResources() { initStandardResources(_facade); } private AWTFacade _facade; private Frame _application; }