This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Applets and the fly likes URL in JEditorPane applet advice please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "URL in JEditorPane applet advice please " Watch "URL in JEditorPane applet advice please " New topic
Author

URL in JEditorPane applet advice please

Billy Sclater
Ranch Hand

Joined: Nov 18, 2012
Posts: 114

My basic goal is to open a JEditorPane in an applet, and then load that pane with a URL.
In the code I have chosen Yahoo.

When I run the applet it does nothing, just remains blank.

Can anyone give me some pointers?

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

You need to add the JEditorPane instance to the applet


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Billy Sclater
Ranch Hand

Joined: Nov 18, 2012
Posts: 114

Of course! Thanks! Interesting though, this class with the 'jep.setPage("http://www.yahoo.com");' method needs to be signed to work.
My other class (you advised me on yesterday) didn't need to be signed with the context.showDocument("http://www.yahoo.com");

Is there anyway I can make this code work without signing the applet?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

The showDocument delegates the call to the browser/applet viewer which is outside the security restrictions of the applet. Thats why you can get it working even unsigned.
Why do you want to avoid signing? Self signing works and its quite a straight forward process.
Billy Sclater
Ranch Hand

Joined: Nov 18, 2012
Posts: 114

The applet is a volunteer job for a friend's website. His company is launching a game in October. I'll add more function to it of course, some links going to different review websites and so on.

About my aversion to self-signing, when I self-sign the applet, a big ugly warning box pops up on the screen with a scary yellow warning triangle and basically says "Do you trust this person?". I think it makes my friend's website look unattractive! I guess it's unavoidable though, then again I could use a decent CA and pay for a digital signature, perhaps then the scary warning box could be ommitted.

By the way, the applet is not essential to my friend's business in anyway, he is just helping me out by giving me some voluntary work to put on my resume!

Thanks again for your help!!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

It's been a while since I worked with applets, and Oracle has made a lot of fixes to applet (and Java) security since then, so now I'm not sure how they work any more. It's possible that even using a corporate-grade digital signature from a recognized CA might still produce a warning box, but perhaps a less scary one. But I don't know that for sure.

However I can say that the company I worked for did run an application (for web ordering) which used a self-signed certificate for several years, and I never heard of any of our customers being scared off by the security dialog. I suppose that since it was on our website they assumed it was okay. People using the web routinely disregard web security, that's why malware writers are so successful.
Billy Sclater
Ranch Hand

Joined: Nov 18, 2012
Posts: 114

Thanks for your input. I've read a couple other posts with similar sentiments about signing and warnings. I think I'm going to be brave and self-sign the applet after all!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URL in JEditorPane applet advice please
 
Similar Threads
browser working with pure java
opening link in new window
JEditorPane problem
java web browser save all images on html for offline viewing
Loading Webpage in JFrame