package extensions.awt; import java.awt.*; public class AppFrame extends FrameExtended { /** * Construct and show an Exception/Error frame. * Never call with exit_status non zero in an applet! * @param t exception/error * @param exit_status if zero dispose upon closing, * otherwise call System.exit(exit_status); * @param stackTrace display listing of stack trace back */ public AppFrame(Throwable t, int exit_status, boolean stackTrace) { super(t,exit_status,stackTrace); } /** * Construct and show an Exception/Error frame. * Never call with exit_status non zero in an applet! * @param t exception/error * @param exit_status if zero dispose upon closing, * otherwise call System.exit(exit_status); */ public AppFrame(Throwable t, int exit_status) { super(t,exit_status); } /** Default construct an instance of the specified * class making it the application's mainWindow, i.e. * calling destroy() terminates the application shutting * down the JVM. If the frame has no title a default * title is set specifically the class name. If either * the width or height parameter is zero the frame is * not resized(). * @param FrameExtendedClassName then name of any * FrameExtended derived class having a meaningful * default constructor * @param width initial frame width * @param height initial frame height * @return returns main window frame * @see #destroy * @see #exitOnDestroy */ public static FrameExtended winMain (String FrameExtendedClassName, int width, int height) { FrameExtended f = null; try { Class metaFrameExtended = Class.forName(FrameExtendedClassName); f = (FrameExtended) metaFrameExtended.newInstance(); exitOnDestroyAll = true; String title = f.getTitle(); if (title != null && title.equals("Untitled")) f.setTitle(f.getClass().getName()); if (width > 0 && height > 0) f.resize(width,height); if (!f.isShowing()) f.show(); } catch (Throwable t) { new FrameExtended(t,-1); } return f; } /** Default construct an instance of the specified * class making it the application's mainWindow, i.e. * calling destroy() terminates the application shutting * down the JVM. If the frame has no title a default * title is set: specifically the class name. * @param FrameExtendedClassName then name of any * FrameExtended derived class having a meaningful * default constructor * @return returns main window frame * @see #destroy * @see #exitOnDestroy */ public static FrameExtended winMain (String FrameExtendedClassName) { return winMain(FrameExtendedClassName,0,0); } /** Construct an instance of FrameExtended adding * the specified component to the center of the * border layout. If either the width or height * parameter is zero the frame is not resized(). * @param c the component to be display in the center * @param width initial frame width * @param height initial frame height * @return returns main window frame * @see #destroy * @see #exitOnDestroy */ public static FrameExtended winMain (Component c, int width, int height) { FrameExtended f = new FrameExtended(); exitOnDestroyAll = true; f.add("Center",c); f.setTitle(c.getClass().getName()); if (width > 0 && height > 0) f.resize(width,height); else f.pack(); f.show(); return f; } /** Construct an instance of FrameExtended adding * the specified component to the center of the * border layout. * @param c the component to be display in the center * @return returns main window frame * @see #destroy * @see #exitOnDestroy */ public static FrameExtended winMain(Component c) { return winMain(c,0,0); } }