// Copyright (c) 1995, 1996 Regents of the University of California. // All rights reserved. // // This software was developed by the Arcadia project // at the University of California, Irvine. // // Redistribution and use in source and binary forms are permitted // provided that the above copyright notice and this paragraph are // duplicated in all such forms and that any documentation, // advertising materials, and other materials related to such // distribution and use acknowledge that the software was developed // by the University of California, Irvine. The name of the // University may not be used to endorse or promote products derived // from this software without specific prior written permission. // THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR // IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED // WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. // File: ActionPrint.java // Classes: ActionPrint // Original Author: jrobbins@ics.uci.edu // $Id: ActionPrint.m4,v 1.1 1997/06/11 01:17:37 jrobbins Exp $ package uci.graphedit; import java.util.*; import java.awt.*; import java.io.*; changequote(<<,>>) /** Action to Print a diagram. Only works under JDK 1.1.

* * FEATURE: printing * * FEATURE: cross_development_environments */ public class ActionPrint extends Action { public ActionPrint() { } public String name() { return "Print Diagram"; } public void doIt(Event e) { ifdef(<>,/* for jdk1.0.2,) System.out.println("This Action is commented out " + "in ActionPrint.java, uncomment " + "and recompile to use. Needs Java 1.1."); ifdef(<>,*/,) ifdef(<>,,/* for jdk1.1) Editor ce = Globals.curEditor(); Toolkit tk = Toolkit.getDefaultToolkit(); Frame someFrame = Globals.someFrame(); PrintJob pjob = tk.getPrintJob(someFrame, "Printing Test", new Properties()); if (pjob != null) { Graphics pg = pjob.getGraphics(); Dimension d = pjob.getPageDimension(); System.out.println("page size is: " + d); // Needs-More-Work: multipage printing pg.clipRect(0, 0, d.width, d.height); if (pg != null) { ce.paint(pg); pg.dispose(); // flush page } pjob.end(); } System.out.println("Printing finished"); ifdef(<>,,*/) } public void undoIt() { System.out.println("Undo does not make sense for ActionPrint"); } } /* end class ActionPrint */