[kepler-dev] kepler/src/org/kepler/scia HelpViewer.java
Christopher Brooks
cxh at eecs.berkeley.edu
Mon Jan 23 16:20:31 PST 2006
Hi Vitaliy,
Sounds good. If you are running standalone without Ptolemy, then
not depending on Ptolemy is the way to go.
_Christopher
--------
Hi Christopher,
I'm sure these classes could be used, but this would introduce dependency
on Ptolemy code. Right now we're compiling SCIA by itself and running it i
n stand-alone mode.
Thanks,
Vitaliy
Christopher Brooks <cxh at eecs.berkeley.edu> wrote:
Hi Vitaliy,
How is this different from either ptolemy/actor/gui/PtolemyQuery.java or
ptolemy/actor/gui/HTMLViewer.java?
I'm not sure if PtolemyQuery handles large messages with scrollbars,
perhaps it should?
Perhaps you HelpViewer should use one of these classes?
Just my $0.02.
_Christopher
--------
zavesov 06/01/22 19:43:14
Added: src/org/kepler/scia HelpViewer.java
Log:
The viewer used to open help files
Revision Changes Path
1.1 kepler/src/org/kepler/scia/HelpViewer.java
Index: HelpViewer.java
===================================================================
/**
* Copyright (c) 2005 The Regents of the University of California.
* All rights reserved.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
* FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
* PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY
* OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
* UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
package org.kepler.scia;
/*-----------------------------------------------------------------------
--------
Vitaliy Zavesov
Jan. 22, 2006
File Name: HelpViewer.java
Description: This class serves as an simple viewer to open help file
s.
-----------------------------------------------------------------------
------*/
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
public class HelpViewer extends JFrame {
// global variables so that they could be set
private String message;
// global variables so that they could be set
private String text;
JPanel contentPane = new JPanel(new BorderLayout());
JButton okButton;
JTextArea textArea;
// constructor
public HelpViewer(final String tit, final String mes, final String te
x) {
setTitle(tit);
// setting the global variable
message = mes;
text = tex;
// position our popup window in the center of the screen
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension d = tk.getScreenSize();
setLocation((d.width / 2) - 250, (d.height / 2) - 50);
setSize(500, 500);
// setting up the panel with a text area
textArea = new JTextArea(text, 20, 40);
int fontSize = textArea.getFont().getSize();
int fontStyle = textArea.getFont().getStyle();
Font newFont = new Font("Courier", fontStyle, fontSize);
textArea.setFont(newFont);
JScrollPane areaScrollPane = new JScrollPane(textArea,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
areaScrollPane.setPreferredSize(new Dimension(400, 400));
JLabel label = new JLabel(message);
JPanel labPan = new JPanel();
labPan.add(label);
okButton = new JButton("OK");
ActionListener aLok = new ActionListener() {
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == okButton) {
hide();
}
}
};
okButton.addActionListener(aLok);
JPanel buttonPan = new JPanel();
buttonPan.add(okButton);
contentPane.add(buttonPan, BorderLayout.SOUTH);
contentPane.add(labPan, BorderLayout.NORTH);
contentPane.add(areaScrollPane, BorderLayout.CENTER);
setContentPane(contentPane);
}
}
_______________________________________________
Kepler-cvs mailing list
Kepler-cvs at ecoinformatics.org
http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-cvs
--------
---------------------------------
Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on ne
w and used cars.
--0-1482965322-1138058891=:24536
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
<DIV>Hi Christopher,</DIV> <DIV> </DIV> <DIV>I'm sure these classes
could be used, but this would introduce dependency on Ptolemy code.&nbs
p; Right now we're compiling SCIA by itself and running it in stand-alone mo
de.</DIV> <DIV> </DIV> <DIV>Thanks,</DIV> <DIV>Vitaliy<BR><BR><B><I>
Christopher Brooks <cxh at eecs.berkeley.edu></I></B> wrote:</DIV> <BLOC
KQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT:
#1010ff 2px solid">Hi Vitaliy,<BR>How is this different from either ptolemy
/actor/gui/PtolemyQuery.java or<BR>ptolemy/actor/gui/HTMLViewer.java?<BR><BR
>I'm not sure if PtolemyQuery handles large messages with scrollbars,<BR>per
haps it should?<BR><BR>Perhaps you HelpViewer should use one of these classe
s?<BR><BR>Just my $0.02.<BR><BR>_Christopher<BR><BR><BR><BR>--------<BR><BR>
zavesov 06/01/22 19:43:14<BR><BR>Added: src/org/kepler/scia HelpViewer.java<
BR>Log:<BR>The viewer used to open help files<BR><BR>Revision Changes Path<B
R>1
.1
kepler/src/org/kepler/scia/HelpViewer.java<BR><BR>Index: HelpViewer.java<B
R>===================================================================<BR>/**
<BR>* Copyright (c) 2005 The Regents of the University of California.<BR>* A
ll rights reserved.<BR>*<BR>* Permission is hereby granted, without written
agreement and without<BR>* license or royalty fees, to use, copy, modify, an
d distribute this<BR>* software and its documentation for any purpose, provi
ded that the<BR>* above copyright notice and the following two paragraphs ap
pear in<BR>* all copies of this software.<BR>*<BR>* IN NO EVENT SHALL THE UN
IVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY<BR>* FOR DIRECT, INDIRECT, SPE
CIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES<BR>* ARISING OUT OF THE USE OF TH
IS SOFTWARE AND ITS DOCUMENTATION, EVEN<BR>* IF THE UNIVERSITY OF CALIFORNIA
HAS BEEN ADVISED OF THE POSSIBILITY<BR>* OF SUCH DAMAGE.<BR>*<BR>* THE UNIV
ERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,<BR>* INCLUDING,
BUT
NOT
LIMITED TO, THE IMPLIED WARRANTIES OF<BR>* MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE. THE SOFTWARE<BR>* PROVIDED HEREUNDER IS ON AN "AS IS"
BASIS, AND THE UNIVERSITY<BR>* OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE M
AINTENANCE, SUPPORT,<BR>* UPDATES, ENHANCEMENTS, OR MODIFICATIONS.<BR>*/<BR>
package org.kepler.scia;<BR><BR><BR>/*--------------------------------------
---------------------------------<BR>--------<BR>Vitaliy Zavesov<BR>Jan. 22,
2006<BR><BR>File Name: HelpViewer.java<BR>Description: This class serves as
an simple viewer to open help file<BR>s.<BR>-------------------------------
----------------------------------------<BR>------*/<BR>import java.awt.Bord
erLayout;<BR>import java.awt.Dimension;<BR>import java.awt.Toolkit;<BR>impor
t java.awt.Font;<BR>import java.awt.event.ActionEvent;<BR>import java.awt.ev
ent.ActionListener;<BR>import java.io.FileOutputStream;<BR>import java.io.Pr
intWriter;<BR><BR>import javax.swing.JButton;<BR>import javax.swing.JFrame;<
BR>
import
javax.swing.JLabel;<BR>import javax.swing.JPanel;<BR>import javax.swing.JS
crollPane;<BR>import javax.swing.JTextArea;<BR><BR><BR>public class HelpView
er extends JFrame {<BR>// global variables so that they could be set<BR>priv
ate String message;<BR><BR>// global variables so that they could be set<BR>
private String text;<BR>JPanel contentPane = new JPanel(new BorderLayout());
<BR>JButton okButton;<BR>JTextArea textArea;<BR><BR>// constructor<BR>public
HelpViewer(final String tit, final String mes, final String te<BR>x) {<BR>s
etTitle(tit);<BR><BR>// setting the global variable<BR>message = mes;<BR>tex
t = tex;<BR><BR>// position our popup window in the center of the screen<BR>
Toolkit tk = Toolkit.getDefaultToolkit();<BR>Dimension d = tk.getScreenSize(
);<BR><BR>setLocation((d.width / 2) - 250, (d.height / 2) - 50);<BR>setSize(
500, 500);<BR><BR>// setting up the panel with a text area<BR>textArea = new
JTextArea(text, 20, 40);<BR><BR>int fontSize = textArea.getFont().getSize()
;<B
R>int
fontStyle = textArea.getFont().getStyle();<BR>Font newFont = new Font("Cou
rier", fontStyle, fontSize);<BR><BR>textArea.setFont(newFont);<BR><BR>JScrol
lPane areaScrollPane = new JScrollPane(textArea,<BR>JScrollPane.VERTICAL_SCR
OLLBAR_ALWAYS,<BR>JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);<BR>areaScrollPan
e.setPreferredSize(new Dimension(400, 400));<BR><BR>JLabel label = new JLabe
l(message);<BR>JPanel labPan = new JPanel();<BR>labPan.add(label);<BR><BR>ok
Button = new JButton("OK");<BR><BR>ActionListener aLok = new ActionListener(
) {<BR>public void actionPerformed(ActionEvent ae) {<BR>if (ae.getSource() =
= okButton) {<BR>hide();<BR>}<BR>}<BR>};<BR><BR>okButton.addActionListener(a
Lok);<BR><BR>JPanel buttonPan = new JPanel();<BR>buttonPan.add(okButton);<BR
>contentPane.add(buttonPan, BorderLayout.SOUTH);<BR><BR>contentPane.add(labP
an, BorderLayout.NORTH);<BR>contentPane.add(areaScrollPane,
BorderLayout.CENTER);<BR><BR>setContentPane(contentPane);<BR>}<BR>}<BR><BR
><BR><BR>_______________________________________________<BR>Kepler-cvs maili
ng list<BR>Kepler-cvs at ecoinformatics.org<BR>http://mercury.nceas.ucsb.edu/ec
oinformatics/mailman/listinfo/kepler-cvs<BR>--------<BR></BLOCKQUOTE> <DIV>
<BR></DIV><p>
<hr size=1> <a href="http://us.rd.yahoo.com/evt=38381/ ylc=X3oD
MTEzcGlrdGY5BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDMWF1dG9z/*http://autos.y
ahoo.com/index.html ">Yahoo! Autos</a>. Looking for a sweet ride? Get pricin
g, reviews, & more on new and used cars.
--0-1482965322-1138058891=:24536--
--------
More information about the Kepler-dev
mailing list