package myproject; import javax.swing.UIManager; import java.awt.*; /** * Title: A Project to hold test programs * Description: * Copyright: Copyright (c) 2001 * Company: Actis Ltd. * @author Martin Milner * @version 1.0 */ public class TextEdit { boolean packFrame = false; static String fname = new String(); // This is a GLOBAL variable /**Construct the application. (NOTE that this is a METHOD of class TextEdit)*/ public TextEdit() { TextEditFrame frame = new TextEditFrame(); //Validate frames that have preset sizes //Pack frames that have useful preferred size info, e.g. from their layout if (packFrame) { frame.pack(); } else { frame.validate(); } //Center the window Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = frame.getSize(); if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; } if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; } frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); frame.setVisible(true); } // end of TextEdit METHOD /**Main method*/ public static void main(String[] args) { fname=""; int len=args.length; if (len != 0) { fname = args[0]; } try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { e.printStackTrace(); } new TextEdit(); } // end of main method } // end of CLASS TextEdit