// -*- java -*- // 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: Compat.java // Classes: Compat // Original Author: jrobbins@ics.uci.edu // $Id: Compat.m4,v 1.6 1997/06/10 23:42:34 jrobbins Exp $ package uci.graphedit; import java.util.*; import java.awt.*; /** This class defines many utility functions that relate to functions * that work differently under Sun's JDK 1.0.2 and JDK 1.1. There are * actually two versions of this file: Compat102.java and * Compat11.java. _One_ of these two files should be copied to the * file named Compat.java. The version needed for a given build is * generated using the m4 utility (also available for Windows * from www.cygnus.com).

* * FEATURE: cross_development_environments * * This version of Compat is for JDK 1.1. */ public class Compat { /** Draw a polyline (open polygon). Different JDK versions do this * differently. */ public static void drawPolyline(Polygon p, Graphics g) { g.drawPolyline(p.xpoints, p.ypoints, p.npoints); //jdk102: g.drawPolygon(p); } /** Draw a polyline (open polygon). Different JDK versions do this * differently. */ public static void drawPolyline(int xs[], int ys[], int np, Graphics g) { g.drawPolyline(xs, ys, np); //jdk102: g.drawPolygon(xs, ys, np); } /** Reply true iff the given Graphics is a print job instead of * something to be displayed on the screen. Always false for * JDK1.0.2. */ public static boolean isPrintJob(Graphics g) { return (g instanceof PrintGraphics); //jdk102: return false; } /** Add a menu item to a Menu. */ public static MenuItem addMenuItem(Menu m, String name) { MenuItem mi = new MenuItem(name); // 1.1 and 1.0.2 m.add(mi); return mi; } /** Add a menu item to a Menu, supports JDK 1.1 keystroke accelerators. */ public static MenuItem addMenuItem(Menu m, String name, int key) { MenuItem mi = new MenuItem(name, new MenuShortcut(key)); //jdk102: MenuItem mi = new MenuItem(name); m.add(mi); return mi; } // Needs-More-Work: add support for Modes to set the mouse cursor // public static void setCursor() { ////jdk102: java.awt.Frame.setCursor(int i); // java.awt.Component.setCursor(Cursor c); // } } /* end class Compat */