/* * Copyright (c) 2003,2004 Aly Merchant * * This software is provided 'as-is', without any express or implied warranty. * In no event will the authors be held liable for any damages arising from the * use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * * 2. Altered source versions must be plainly marked as such, and must not * be misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source * distribution. */ package tenk; import javax.swing.*; import java.awt.BorderLayout; import java.awt.Canvas; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.GraphicsEnvironment; import java.awt.Rectangle; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.print.PrinterJob; import java.io.*; import java.util.ArrayList; public class UI implements Runnable { JFrame frame; public void initFrame() { JFrame.setDefaultLookAndFeelDecorated(true); frame = new JFrame("Certficate Printer [10K Run for Charity]"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //frame.setBounds(100,50,700,550); Rectangle r = frame.getGraphicsConfiguration().getBounds(); r.grow(-50,-50); frame.setBounds(r); JPanel mainPanel = new JPanel(new GridLayout(1,0)); mainPanel.add( (new MRPanel()).getPanel() ); mainPanel.add( (new FRPanel()).getPanel() ); frame.setContentPane(mainPanel); frame.show(); } public void run() { initFrame(); } public static void main(String[] args) { if (args.length > 0) Data.setDB(args[0]); else Data.setDB(); Data.refresh(); if (!Data.isConnected()) { System.out.println("*** NOTE: System is disconnected from the database."); Data.setUsingDB(false); } SwingUtilities.invokeLater(new UI()); } }