All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class fix.Util

java.lang.Object
   |
   +----fix.Util

public final class Util
extends Object
This class contains various utilities for overcomming bugs or design shortcomings in the Java implementations that I have available right now. It is recommended that the package fix.* never be imported, so that there is no confusion between java.* classes and fix.* classes of the same name.

This code is (c) 1997 Leemon Baird <leemon@cs.cmu.edu>, http://www.cs.cmu.edu/~baird
The source and object code may be redistributed freely. If the code is modified, please state so in the comments.

Version:
1.1 29 Mar 97
Author:
Leemon Baird

Constructor Index

 o Util()

Method Index

 o new_(String)
Create a new instance of this class.
 o paintAll(Graphics, Component, boolean, boolean)
logically, the call: myComponent.paintAll(graphicsContext) should paint the Component myComponent, and if it is a container, should paint its contents.
 o toString(double, int, int)
Convert a float or double to a string, rounding to display at most dig digits, and converting to scientific notation if necessary to ensure that a minimum of msf significant figures appear in numbers like 0.000123.

Constructors

 o Util
 public Util()

Methods

 o paintAll
 public static void paintAll(Graphics g,
                             Component c,
                             boolean changeOriginal,
                             boolean flicker)
logically, the call: myComponent.paintAll(graphicsContext) should paint the Component myComponent, and if it is a container, should paint its contents. If g is an arbitrary Graphics (e.g. an offscreen buffer), then Component.paintAll() doesn't work. The following at least works for user-defined Components where paint() has been overridden. It doesn't work for all the standard AWT components with the original paint(). The call given above should be translated into: fix.Util.paintAll(graphicsContext,myComponent); Normally, changeOriginal should be false, so the translating and clipping won't damage the original Graphics. But if the Graphics is something unusual, such as a front end to Postscript output to a file, then it may be preferable to change the original and do all the drawing there rather than drawing to a copy of the Graphics and then dumping a bit map of the result back into the original. The parameter flicker is true if double buffering should be turned off in the Display objects, else it will be turned on in them.

 o new_
 public static final Object new_(String s)
Create a new instance of this class. According to the Java 1.0 specs, you should be able to say: MyClass x=new("MyClass"); But the JDK-1.0 compiler calls it a feature that is not yet implemented, so instead, say: MyClass x=fix.Util.new_("MyClass");

 o toString
 public static String toString(double x,
                               int dig,
                               int msf)
Convert a float or double to a string, rounding to display at most dig digits, and converting to scientific notation if necessary to ensure that a minimum of msf significant figures appear in numbers like 0.000123. This is particularly useful for running Java 1.0 programs (which have no way to control the precision when printing numbers) on a Java 1.1 VM (which tends to use lots of decimal places by default).


All Packages  Class Hierarchy  This Package  Previous  Next  Index