Source code: org/merlotxml/merlot/MerlotAbout.java
1 /*
2 ====================================================================
3 Copyright (c) 1999-2000 ChannelPoint, Inc.. All rights reserved.
4 ====================================================================
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions
8 are met:
9
10 1. Redistribution of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12
13 2. Redistribution in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in the
15 documentation and/or other materials provided with the distribution.
16
17 3. All advertising materials mentioning features or use of this
18 software must display the following acknowledgment: "This product
19 includes software developed by ChannelPoint, Inc. for use in the
20 Merlot XML Editor (http://www.merlotxml.org/)."
21
22 4. Any names trademarked by ChannelPoint, Inc. must not be used to
23 endorse or promote products derived from this software without prior
24 written permission. For written permission, please contact
25 legal@channelpoint.com.
26
27 5. Products derived from this software may not be called "Merlot"
28 nor may "Merlot" appear in their names without prior written
29 permission of ChannelPoint, Inc.
30
31 6. Redistribution of any form whatsoever must retain the following
32 acknowledgment: "This product includes software developed by
33 ChannelPoint, Inc. for use in the Merlot XML Editor
34 (http://www.merlotxml.org/)."
35
36 THIS SOFTWARE IS PROVIDED BY CHANNELPOINT, INC. "AS IS" AND ANY EXPRESSED OR
37 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
38 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
39 EVENT SHALL CHANNELPOINT, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
40 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
41 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
45 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46 ====================================================================
47
48 For more information on ChannelPoint, Inc. please see http://www.channelpoint.com.
49 For information on the Merlot project, please see
50 http://www.merlotxml.org
51 */
52
53
54 // Copyright 1999 ChannelPoint, Inc., All Rights Reserved.
55
56 package org.merlotxml.merlot;
57
58 import java.io.*;
59 import java.awt.*;
60 import java.awt.event.*;
61 import java.awt.dnd.*;
62 import java.awt.datatransfer.*;
63 import java.util.*;
64
65 import javax.swing.*;
66 import javax.swing.event.*;
67 import javax.swing.tree.*;
68 import javax.swing.table.*;
69 import javax.swing.border.*;
70 import org.w3c.dom.*;
71
72 import com.sun.javax.swing.*;
73
74
75 /**
76 * About screen for merlot with cool animation someday
77 */
78
79 public class MerlotAbout extends JInternalFrame
80 implements Runnable, MerlotConstants
81 {
82
83 XMLEditorFrame _frame;
84 AboutScroller _scroller;
85
86
87 public MerlotAbout(XMLEditorFrame frame)
88 {
89 super(MerlotResource.getString(UI,"help.about")+" "
90 +XMLEditorSettings.getSharedInstance().getFrameTitle(), false,true);
91 _frame = frame;
92 setupPanel();
93 this.addInternalFrameListener( new InternalFrameAdapter() {
94 public void internalFrameClosing(InternalFrameEvent e)
95 {
96 if (_scroller != null) {
97 _scroller.stop();
98 }
99
100 }
101 });
102 }
103
104 protected void setupPanel()
105 {
106 try {
107 ImageIcon pic = MerlotResource.getImage(UI,"about.background");
108
109 JLabel label = new JLabel(pic);
110 JPanel p = new JPanel(new BorderLayout());
111 p.setBorder(new EmptyBorder(5,5,5,5));
112
113 p.add(label,BorderLayout.CENTER);
114
115 _scroller = new AboutScroller();
116 p.add(_scroller, BorderLayout.SOUTH);
117
118 this.getContentPane().add(p);
119 // figure out where to put this to center it
120 Dimension d = _frame.getSize();
121 this.pack();
122 Dimension e = this.getSize();
123 int x,y;
124 x = (d.width / 2) - (e.width / 2);
125 y = (d.height / 2) - (e.height / 2) - 25;
126 this.setLocation(x,y);
127 }
128 catch (Exception ex) {
129 MerlotDebug.exception(ex);
130 }
131 }
132
133 public void run ()
134 {
135 _frame.addInternalFrame(this,false);
136 Thread t = new Thread(_scroller);
137 t.start();
138 }
139
140 protected class AboutScroller extends JPanel
141 implements Runnable
142 {
143 String _stuff[];
144
145 final static long FIVE_SECONDS = 5 * 1000;
146 boolean _stop = false;
147 JPanel _multiLineLabel;
148
149
150 public AboutScroller()
151 {
152 super();
153 _stuff = new String[2];
154 _stuff[0] = MerlotResource.getString(UI,"merlot.version.string");
155 _stuff[1] = MerlotResource.getString(UI,"merlot.copyright");
156
157 //setText(_stuff[0]);
158 _multiLineLabel = MerlotUtils.createMultiLineLabel(_stuff[0],50);
159 _multiLineLabel.setBorder(new EmptyBorder(2,2,2,2));
160
161 add(_multiLineLabel,BorderLayout.WEST);
162
163
164 }
165
166 public void run()
167 {
168 int i = 0;
169 while (!_stop) {
170 try {
171 Thread.sleep(FIVE_SECONDS);
172 }
173 catch (InterruptedException ex) {
174 }
175 this.remove(_multiLineLabel);
176
177 i = (i + 1) % _stuff.length;
178 // setText(_stuff[i]);
179 _multiLineLabel = MerlotUtils.createMultiLineLabel(_stuff[i],50);
180 _multiLineLabel.setBorder(new EmptyBorder(2,2,2,2));
181 add(_multiLineLabel,BorderLayout.WEST);
182 this.validate();
183
184
185 }
186 }
187
188 public void stop()
189 {
190 _stop = true;
191 }
192 }
193 }