// This example is from the book _Java AWT Reference_ by John Zukowski. // Written by John Zukowski. Copyright (c) 1997 O'Reilly & Associates. // You may study, use, modify, and distribute this example for any purpose. // This example is provided WITHOUT WARRANTY either expressed or import java.awt.*; public class Center extends Frame { static String text[]; private Dimension dim; static public void main (String args[]) { if (args.length == 0) { System.err.println ("Usage: java Center "); return; } text = args; Center f = new Center(); f.show(); } public void addNotify() { super.addNotify(); int maxWidth = 0; FontMetrics fm = getToolkit().getFontMetrics(getFont()); for (int i=0;i