001 package com.croftsoft.apps.agoracast.c2p; 002 003 import java.awt.*; 004 import java.awt.event.*; 005 import java.io.*; 006 import javax.swing.*; 007 008 import com.croftsoft.core.gui.LicenseFrame; 009 import com.croftsoft.core.lang.ClassLib; 010 import com.croftsoft.core.util.log.PrintStreamLog; 011 012 /********************************************************************* 013 * The main class for Agoracast C2P. 014 * 015 * <p /> 016 * 017 * @version 018 * 2002-01-27 019 * @since 020 * 2001-05-17 021 * @author 022 * <a href="https://www.croftsoft.com/">David Wallace Croft</a> 023 *********************************************************************/ 024 025 public final class Agoracast 026 implements ActionListener, AgoracastConstants, Runnable 027 ////////////////////////////////////////////////////////////////////// 028 ////////////////////////////////////////////////////////////////////// 029 { 030 031 private LicenseFrame licenseFrame; 032 033 ////////////////////////////////////////////////////////////////////// 034 ////////////////////////////////////////////////////////////////////// 035 036 public static void main ( String [ ] args ) 037 throws IOException 038 ////////////////////////////////////////////////////////////////////// 039 { 040 new Agoracast ( ); 041 } 042 043 ////////////////////////////////////////////////////////////////////// 044 ////////////////////////////////////////////////////////////////////// 045 046 public Agoracast ( ) 047 throws IOException 048 ////////////////////////////////////////////////////////////////////// 049 { 050 String licenseAgreementText = null; 051 052 try 053 { 054 licenseAgreementText = ClassLib.getResourceAsText ( 055 Agoracast.class, AgoracastConstants.LICENSE_FILENAME ); 056 } 057 catch ( IOException ex ) 058 { 059 System.err.println ( 060 "Failure loading " + AgoracastConstants.LICENSE_FILENAME ); 061 062 throw ex; 063 } 064 065 Image frameIconImage = null; 066 067 try 068 { 069 frameIconImage = ClassLib.getResourceAsImage ( Agoracast.class, 070 AgoracastConstants.LICENSE_FRAME_ICON_IMAGE_NAME ); 071 } 072 catch ( Exception ex ) 073 { 074 System.err.println ( "Failure loading " 075 + AgoracastConstants.LICENSE_FRAME_ICON_IMAGE_NAME ); 076 077 ex.printStackTrace ( ); 078 } 079 080 Image splashImage = null; 081 082 try 083 { 084 splashImage = ClassLib.getResourceAsImage ( Agoracast.class, 085 AgoracastConstants.SPLASH_IMAGE_NAME ); 086 } 087 catch ( Exception ex ) 088 { 089 System.err.println ( "Failure loading " 090 + AgoracastConstants.SPLASH_IMAGE_NAME ); 091 092 ex.printStackTrace ( ); 093 } 094 095 licenseFrame = new LicenseFrame ( 096 licenseAgreementText, 097 this, 098 ( ActionListener ) null, 099 ( Color ) null, 100 LICENSE_FRAME_TITLE, 101 ( Dimension ) null, 102 frameIconImage, 103 splashImage ); 104 105 licenseFrame.setVisible ( true ); 106 } 107 108 ////////////////////////////////////////////////////////////////////// 109 ////////////////////////////////////////////////////////////////////// 110 111 public void actionPerformed ( ActionEvent actionEvent ) 112 ////////////////////////////////////////////////////////////////////// 113 { 114 SwingUtilities.invokeLater ( this ); 115 } 116 117 public void run ( ) 118 ////////////////////////////////////////////////////////////////////// 119 { 120 // Consider loading documentation only when needed. 121 122 String documentationText = "Documenation not found."; 123 124 try 125 { 126 documentationText = ClassLib.getResourceAsText ( 127 Agoracast.class, AgoracastConstants.DOCUMENTATION_FILENAME ); 128 } 129 catch ( Exception ex ) 130 { 131 ex.printStackTrace ( ); 132 } 133 134 AgoracastMediator agoracastMediator 135 = new AgoracastMediator ( ); 136 137 agoracastMediator.init ( ); 138 139 new AgoracastFrame ( 140 agoracastMediator, documentationText ).setVisible ( true ); 141 142 licenseFrame.setVisible ( false ); 143 144 licenseFrame.dispose ( ); 145 146 licenseFrame = null; 147 } 148 149 ////////////////////////////////////////////////////////////////////// 150 ////////////////////////////////////////////////////////////////////// 151 }