00001
00057 package com.arcle.rmt.j2se.swing;
00058 import javax.swing.*;
00059 import javax.swing.text.JTextComponent;
00060 import java.awt.Frame;
00061 import java.awt.Component;
00062 import java.awt.Container;
00063 import java.awt.FlowLayout;
00064 import java.awt.BorderLayout;
00065 import java.awt.event.*;
00066 import java.awt.Window;
00067 import java.io.InputStream;
00068 import java.io.StringWriter;
00069 import java.io.InputStreamReader;
00070 import java.io.BufferedReader;
00071 import java.io.IOException;
00072
00073 import com.arcle.rmt.j2se.swing.ui.MoreSwingUtilities;
00074
00080 public class AboutDialog extends JDialog {
00081
00082 private static final String APP_NAME = "Rambutan";
00083
00084 private static final String APP_DESC = "Requirements Management Tool for Busy System Analysts";
00085
00086 private static final String ORG_NAME = "Arcle Technologies";
00087
00088 private static final String ORG_URL = "http://www.arcle.com";
00089
00090 private static final String COPYRIGHT = "Copyright (C) Sasmito Adibowo, 2003";
00091
00092
00093 private static final String RELEASE_VERSION = "0.1-rc1";
00094
00095
00096 public AboutDialog(Component owner) {
00097 super(MoreSwingUtilities.findFirstParentFrame(owner), true);
00098 }
00099
00100 protected void dialogInit() {
00101 super.dialogInit();
00102 initChildren();
00103 layoutChildren();
00104 pack();
00105 setLocationRelativeTo(getOwner());
00106 }
00107
00108
00109 protected void initChildren() {
00110 lbLogo = new JLabel("(logo)");
00111 lbVersion = new JLabel(RELEASE_VERSION);
00112 lbAppName = new JLabel(APP_NAME);
00113 lbAppDesc = new JLabel(APP_DESC);
00114 lbCopyright = new JLabel(COPYRIGHT);
00115 lbOrgName = new JLabel(ORG_NAME);
00116 lbOrgURL = new JLabel(ORG_URL);
00117
00118
00119 btOk = new JButton("OK");
00120 btOk.addActionListener(new ActionListener() {
00121 public void actionPerformed(ActionEvent e) {
00122 dispose();
00123 }
00124 });
00125
00126 btLicenses = new JButton("License...");
00127 btLicenses.addActionListener(new ActionListener() {
00128 public void actionPerformed(ActionEvent e) {
00129 cmdShowLicense();
00130 }
00131 });
00132
00133 getRootPane().setDefaultButton(btOk);
00134
00135
00136
00137 }
00138
00139 protected void layoutChildren() {
00140 Container p1, p2, p3;
00141 FlowLayout fl;
00142
00143 Container content = getContentPane();
00144 content.setLayout(new BorderLayout());
00145
00146
00147 p1 = new JPanel();
00148 p1.setLayout(new BorderLayout());
00149 p1.add(new JScrollPane(lbLogo), BorderLayout.WEST);
00150
00151
00152 p2 = Box.createVerticalBox();
00153 fl = new FlowLayout(FlowLayout.LEFT, 4, 0);
00154 p3 = new JPanel();
00155 p3.setLayout(fl);
00156 p3.add(lbAppName);
00157 p3.add(lbVersion);
00158 p2.add(p3);
00159 p3 = new JPanel();
00160 p3.setLayout(fl);
00161 p3.add(lbAppDesc);
00162 p2.add(p3);
00163 p3 = new JPanel();
00164 p3.setLayout(fl);
00165 p3.add(lbCopyright);
00166 p2.add(p3);
00167 p3 = new JPanel();
00168 p3.setLayout(fl);
00169 p3.add(lbOrgName);
00170 p2.add(p3);
00171 p3 = new JPanel();
00172 p3.setLayout(fl);
00173 p3.add(lbOrgURL);
00174 p2.add(p3);
00175 p1.add(p2, BorderLayout.CENTER);
00176 content.add(p1, BorderLayout.NORTH);
00177
00178
00179
00180
00181 p1 = new JPanel();
00182 p1.setLayout(new BorderLayout());
00183 p2 = new JPanel();
00184 p2.setLayout(new FlowLayout(FlowLayout.CENTER));
00185 p2.add(btOk);
00186 p1.add(p2, BorderLayout.CENTER);
00187 content.add(p1, BorderLayout.SOUTH);
00188 }
00189
00190
00191 protected void cmdShowLicense() {
00192 readLicense();
00193 }
00194
00195 protected void readLicense() {
00196 try {
00197 BufferedReader license = new
00198 BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/com/arcle/rmt/j2se/resources/license.txt")));
00199 String line;
00200 while ((line = license.readLine()) != null) {
00201 System.out.println(line);
00202 }
00203
00204 } catch(IOException e) {
00205 e.printStackTrace();
00206 }
00207
00208 }
00209
00210
00211
00212 private JButton btOk;
00213
00214 private JButton btLicenses;
00215
00216 private JLabel lbLogo;
00217
00218 private JLabel lbRelease;
00219
00220 private JLabel lbVersion;
00221
00222 private JLabel lbAppName;
00223
00224 private JLabel lbAppDesc;
00225
00226 private JLabel lbCopyright;
00227
00228 private JLabel lbOrgName;
00229
00230 private JLabel lbOrgURL;
00231
00232 }