Board index » jbuilder » a window with allot of text called from an applet

a window with allot of text called from an applet


2004-01-27 11:48:27 AM
jbuilder5
Looking for the best way to create a help page that will explain how my
applet functions. The page will be called from a menu bar. I need a new
window with a lot of space to write text. Thanks....
 
 

Re:a window with allot of text called from an applet

"Jacques Chaurette" < XXXX@XXXXX.COM >writes:
Quote
Looking for the best way to create a help page that will explain how my
applet functions. The page will be called from a menu bar. I need a new
window with a lot of space to write text. Thanks....
Use
getAppletContext().showDocument("http://url/to/help.html"), "_blank");
 

Re:a window with allot of text called from an applet

JBuilder cannot find the showDocument method, this is the code I used:
getAppletContext().showDocument("www.fluidedesign.com/help.html", "
");
I must be missing an import statement since JBuilder cannot find the method,
is that correct?
do you know the import statement?
thanks.
jacques
"Tor Iver Wilhelmsen (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote
"Jacques Chaurette" < XXXX@XXXXX.COM >writes:

>Looking for the best way to create a help page that will explain how my
>applet functions. The page will be called from a menu bar. I need a new
>window with a lot of space to write text. Thanks....

Use

getAppletContext().showDocument("http://url/to/help.html"), "_blank");
 

{smallsort}

Re:a window with allot of text called from an applet

It seems that the getAppletContext is part of java.applet.* which I have as
an import statement, so no help there.
I realize the importance of the _blank arg. so I put it back in:
getAppletContext().showDocument("www.fluidedesign.com/help.html",
"_blank");
but still no go....??????
"Jacques Chaurette" < XXXX@XXXXX.COM >wrote in message
Quote
JBuilder cannot find the showDocument method, this is the code I used:
getAppletContext().showDocument("www.fluidedesign.com/help.html",
"
");
I must be missing an import statement since JBuilder cannot find the
method,
is that correct?
do you know the import statement?

thanks.

jacques

"Tor Iver Wilhelmsen (TeamB)" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...
>"Jacques Chaurette" < XXXX@XXXXX.COM >writes:
>
>>Looking for the best way to create a help page that will explain how
my
>>applet functions. The page will be called from a menu bar. I need a
new
>>window with a lot of space to write text. Thanks....
>
>Use
>
>getAppletContext().showDocument("http://url/to/help.html"), "_blank");


 

Re:a window with allot of text called from an applet

Jacques Chaurette wrote:
Quote
It seems that the getAppletContext is part of java.applet.* which I have as
an import statement, so no help there.

I realize the importance of the _blank arg. so I put it back in:
getAppletContext().showDocument("www.fluidedesign.com/help.html",
"_blank");

but still no go....??????

AFAIK, the first parameter needs to be a URL. Try :
import java.net.URL;
...
getAppletContext().showDocument( new
URL("www.fluidedesign.com/help.html"), "_blank");
--
Regards,
Lori Olson (TeamB)
------------
Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.
Google Advanced Newsgroup Search
www.google.ca/advanced_group_search
Other Newsgroup Searches:
www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
www.visi.com/~gyles19/fom-serve/cache/1.html
 

Re:a window with allot of text called from an applet

Huuuum, program will not compile this gives a malformedUrlException.
"Lori M Olson (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote
Jacques Chaurette wrote:

>It seems that the getAppletContext is part of java.applet.* which I have
as
>an import statement, so no help there.
>
>I realize the importance of the _blank arg. so I put it back in:
>getAppletContext().showDocument("www.fluidedesign.com/help.html",
>"_blank");
>
>but still no go....??????
>

AFAIK, the first parameter needs to be a URL. Try :

import java.net.URL;
...
getAppletContext().showDocument( new
URL("www.fluidedesign.com/help.html"), "_blank");

--

Regards,

Lori Olson (TeamB)

------------

Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.

Google Advanced Newsgroup Search
www.google.ca/advanced_group_search
Other Newsgroup Searches:
www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
www.visi.com/~gyles19/fom-serve/cache/1.html

 

Re:a window with allot of text called from an applet

Jacques Chaurette wrote:
Quote
Huuuum, program will not compile this gives a malformedUrlException.


you have to catch exceptions in Java..
Example
try {
this.getAppletContext(new URL("www.somedocument.html",_blank);
}
catch (MalformedURLException malex){
JOptionPane.showMessageDialog(null, "Could not connect to help. Error "+
"message reported was:\n"
+malex.getMessage());
}
anytime a method you are calling throws an Exception you must catch it.
Example
public class MyClass() {
public someClassMethod() throws IOException {
//some some io work
}
}
to call this, someClassMethod, the calling method must catch any
IOExceptions that could be returned.
public class SecondClass {
MyClass mClass= new MyClass();
....
private jbtnHelp_actionPerformed(ActionEvent e) {
//Call someClassMethod from mClass instance
try {
mCLass.someClassMethod();
}
catch(IOException ioex) {
ioex.printStackTrace();
}
}
}
 

Re:a window with allot of text called from an applet

Huuuum there seems to be a paranthese missing in your expression. I put it
in but it still will not compile. You did not use the showDocument method,
was that on purpose?
I tried this method as so:
try {
this.getAppletContext.showDocument(new
URL("www.somedocument.html"),_blank);
}
catch (MalformedURLException malex){
JOptionPane.showMessageDialog(null, "Could not connect to help. Error "+
"message reported was:\n"
+malex.getMessage());
}
but this does not work eiher, compiler message: cannot resolve symbol
variable; referring to appletContext
?? Thanks....
Jack
"pnichols" < XXXX@XXXXX.COM >wrote in message
Quote
Jacques Chaurette wrote:

>Huuuum, program will not compile this gives a malformedUrlException.
>
>
you have to catch exceptions in Java..

Example

try {
this.getAppletContext(new URL("www.somedocument.html",_blank);
}
catch (MalformedURLException malex){
JOptionPane.showMessageDialog(null, "Could not connect to help. Error
"+
"message reported was:\n"
+malex.getMessage());
}

anytime a method you are calling throws an Exception you must catch it.

Example
public class MyClass() {
public someClassMethod() throws IOException {
//some some io work
}

}

to call this, someClassMethod, the calling method must catch any
IOExceptions that could be returned.

public class SecondClass {
MyClass mClass= new MyClass();

....

private jbtnHelp_actionPerformed(ActionEvent e) {
//Call someClassMethod from mClass instance
try {
mCLass.someClassMethod();
}
catch(IOException ioex) {
ioex.printStackTrace();
}
}

}

 

Re:a window with allot of text called from an applet

"Jacques Chaurette" < XXXX@XXXXX.COM >writes:
Quote
this.getAppletContext
should be this.getAppletContext()
It's a method, not a variable
 

Re:a window with allot of text called from an applet

Yes you are right, I have tried this:
try {
this.getAppletContext().showDocument(new
URL("www.somedocument.html"),"_blank");
}
catch (MalformedURLException malex){
JOptionPane.showMessageDialog(null, "Could not connect to help. Error "+
"message reported was:\n"
+malex.getMessage());
}
compiler shows 1 error: cannot resolve symbol method getAppletContext()
I have the import statement: import jave.net.*;
"Tor Iver Wilhelmsen (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote
"Jacques Chaurette" < XXXX@XXXXX.COM >writes:

>this.getAppletContext

should be this.getAppletContext()

It's a method, not a variable
 

Re:a window with allot of text called from an applet

OK, the code compiles now.
It seems that the this. qualifier before the getAppletContext() was the
problem.
Now on to the next problem, the program runs but a browser does not appear
with the desired file.
The complete code for the actionListener is this:
class getHelp implements ActionListener{
public void actionPerformed(ActionEvent evt)
{
try {
getAppletContext().showDocument(new
URL("www.fluidedesign.com/help.html"),"_blank");
}
catch (MalformedURLException malex){
JOptionPane.showMessageDialog(null, "Could not connect to help. Error "+
"message reported was:\n"
+malex.getMessage());
}
}
}
The menu bar is initalized with these commands:
JMenuBar bar = new JMenuBar();
JMenu menu;
JMenu submenu;
JMenuItem item;
menu = new JMenu("Help");
bar.add(menu);
item = new JMenuItem("Help HTML");
item.addActionListener(new getHelp());
menu.add(item);
setJMenuBar(bar);
"Jacques Chaurette" < XXXX@XXXXX.COM >wrote in message
Quote
Yes you are right, I have tried this:
try {
this.getAppletContext().showDocument(new
URL("www.somedocument.html"),"_blank");
}
catch (MalformedURLException malex){
JOptionPane.showMessageDialog(null, "Could not connect to help. Error
"+
"message reported was:\n"
+malex.getMessage());
}
compiler shows 1 error: cannot resolve symbol method getAppletContext()

I have the import statement: import jave.net.*;



"Tor Iver Wilhelmsen (TeamB)" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...
>"Jacques Chaurette" < XXXX@XXXXX.COM >writes:
>
>>this.getAppletContext
>
>should be this.getAppletContext()
>
>It's a method, not a variable


 

Re:a window with allot of text called from an applet

Jacques Chaurette wrote:
Quote
Huuuum there seems to be a paranthese missing in your expression. I put it
in but it still will not compile. You did not use the showDocument method,
was that on purpose?
I tried this method as so:
try {
this.getAppletContext.showDocument(new
URL("www.somedocument.html"),_blank);
}
catch (MalformedURLException malex){
JOptionPane.showMessageDialog(null, "Could not connect to help. Error
"+
"message reported was:\n"
+malex.getMessage());
}

No, I was demonstrating that you had to include your code inside a try {}
catch{}. I did not know you needed specific help with the code itself. My
mistake <G>.
Should be :
try {
this.getAppletContext().showDocument(new URL("http:/
www.somedocument.html",blank));
}
catch (MalformedURLException malex) {
JOptionPane.showMessageDialog(null,malex.getMessage());
}
 

Re:a window with allot of text called from an applet

OK, the code compiles now.
It seems that the this. qualifier before the getAppletContext() was the
problem.
Now on to the next problem, the program runs but a browser does not appear
with the desired file. I am connected to the internet.
The complete code for the actionListener is this:
class getHelp implements ActionListener{
public void actionPerformed(ActionEvent evt)
{
try {
getAppletContext().showDocument(new
URL("www.fluidedesign.com/help.html"),"_blank");
}
catch (MalformedURLException malex){
JOptionPane.showMessageDialog(null, "Could not connect to help. Error "+
"message reported was:\n"
+malex.getMessage());
}
}
}
The menu bar is initalized with these commands:
JMenuBar bar = new JMenuBar();
JMenu menu;
JMenu submenu;
JMenuItem item;
menu = new JMenu("Help");
bar.add(menu);
item = new JMenuItem("Help HTML");
item.addActionListener(new getHelp());
menu.add(item);
setJMenuBar(bar);
Jacques
"pnichols" < XXXX@XXXXX.COM >wrote in message
Quote
Jacques Chaurette wrote:

>Huuuum there seems to be a paranthese missing in your expression. I put
it
>in but it still will not compile. You did not use the showDocument
method,
>was that on purpose?
>I tried this method as so:
>try {
>this.getAppletContext.showDocument(new
>URL("www.somedocument.html"),_blank);
>}
>catch (MalformedURLException malex){
>JOptionPane.showMessageDialog(null, "Could not connect to help.
Error
>"+
>"message reported was:\n"
>+malex.getMessage());
>}
>
No, I was demonstrating that you had to include your code inside a try {}
catch{}. I did not know you needed specific help with the code itself. My
mistake <G>.

Should be :

try {
this.getAppletContext().showDocument(new URL("http:/
www.somedocument.html",blank));
}
catch (MalformedURLException malex) {
JOptionPane.showMessageDialog(null,malex.getMessage());
}

 

Re:a window with allot of text called from an applet

Jacques,
I had a quick play with your code. If you read the Java Docs for
showDocument() it says
"An applet viewer or browser is free to ignore showDocument. "
If you use the Applet viewer that comes with JBuilder it ignores it,
however, IE6 (which you say you are using in another post) supports it. I
was able to run your code with IE6 and 1.4.2 plug-in
Arth
"Jacques Chaurette" < XXXX@XXXXX.COM >wrote in message
Quote
OK, the code compiles now.

It seems that the this. qualifier before the getAppletContext() was the
problem.
Now on to the next problem, the program runs but a browser does not appear
with the desired file. I am connected to the internet.

<SNIP/>
 

Re:a window with allot of text called from an applet

Thanks, I guess if I ever get my applet to run on IE I will get to try it
out.
Cheers,
Jacques
"Arthur Ore" < XXXX@XXXXX.COM >wrote in message
Quote
Jacques,

I had a quick play with your code. If you read the Java Docs for
showDocument() it says
"An applet viewer or browser is free to ignore showDocument. "

If you use the Applet viewer that comes with JBuilder it ignores it,
however, IE6 (which you say you are using in another post) supports it. I
was able to run your code with IE6 and 1.4.2 plug-in

Arth

"Jacques Chaurette" < XXXX@XXXXX.COM >wrote in message
news:401906f0$ XXXX@XXXXX.COM ...
>OK, the code compiles now.
>
>It seems that the this. qualifier before the getAppletContext() was the
>problem.
>Now on to the next problem, the program runs but a browser does not
appear
>with the desired file. I am connected to the internet.
>
<SNIP/>