Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-26-2008, 07:37 AM
Member
 
Join Date: Sep 2008
Posts: 4
Rep Power: 0
Nicolai is on a distinguished road
Default Embedding browser functionality in a Java application
Hi.

I'm your standard newbie in all sense. So you'll have to forgive me if this is the wrong forum to post this thread. Please advice me if it is so.

I have a question regarding how to embed browser functionality into a Java application.

Is there any way to create a java application that can report to a embedded web browser (e.g. firefox). Lets say that you have an application that retrieves info from a db and you what to have that info displayed in a browser like window, using e.g. css as a formatting tool.

So my questions are:
  1. Can you embed e.g. firefox browser into an application?
  2. Can you format the output from the application with css (or other forms of formatting)?
  3. Would xml be a good candidate for data transport between the application and the browser/display window?

Hope you can shed a little light on these matters. If you could point to excisting project that would be a great help.

Thank you for your help in advance.

Nicolai
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 09-26-2008, 03:21 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,225
Rep Power: 4
Norm is on a distinguished road
Default
1)What do you mean by "embed? Would starting the browser in its own process in a java app be considered embedding?
2)How are you generating the output? Is the java app supposed to read a file with css and format it? I don't think that is part of native java.
3) What do you mean by "data transport"? Would writing a disk file to be read by the browser be data transport? It would be one time thing done before the browser was started.
Another way that I've used is to have the java app be a HTTP server that starts the browser and communicates with the browser via a Socket using HTTP protcol.
See following for example:
http://shellknob2007.googlepages.com...rverSource.zip
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 09-29-2008, 08:57 AM
Member
 
Join Date: Sep 2008
Posts: 4
Rep Power: 0
Nicolai is on a distinguished road
Default
Hi.

First of all i'd like to thank you for your reply. I'll try to elucidate what I mean.

1)What do you mean by "embed? Would starting the browser in its own process in a java app be considered embedding?

I have an application using the Java html generator (i think). It is very limited in generating html-pages regarding fonts, formatting a.s.o. I was wondering if you could use e.g. the mozilla browser engine to be the rendering machine. By embedding I was thinking about having a window in my application that uses e.g. the mozilla engine and not the java html generator.


2)How are you generating the output? Is the java app supposed to read a file with css and format it? I don't think that is part of native java.

The output are governed by SQL statements retrieving info from an Oracle database. Here tags for font, formatting is added before send to either the html-geberator or the rtf-generator. It is either converted to rtf for paper prints or to html for on screen display. I was thinking that you could use only of type of outputs (html) reading a CSS-file (maybe) for formatting and then generate the html (both for prints and for screen display)


3) What do you mean by "data transport"? Would writing a disk file to be read by the browser be data transport? It would be one time thing done before the browser was started.

One could write to a temporary file that the browser should read using css-formatting (if this is possible). The browser should/could be started at the start of the application.

I hope I make make myself remotely understandable.

Nicolai
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 09-29-2008, 01:31 PM
Nicholas Jordan's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 1,018
Rep Power: 3
Nicholas Jordan is on a distinguished road
Post some suggestions
Originally Posted by Nicolai View Post
I have an application using the Java html generator (i think). It is very limited in generating html-pages regarding fonts, formatting a.s.o. I was wondering if you could use e.g. the mozilla browser engine to be the rendering machine. By embedding I was thinking about having a window in my application that uses e.g. the mozilla engine and not the java html generator.
Java is embedded in Mozilla, usually it is simpler to use the Java HTML Editor Kit which, as you say, has limited capabilities. You make an interesting point; Java is nativily network-centric but the 'browser' is remarkably limited.

Originally Posted by Nicolai View Post
The output are governed by SQL statements retrieving info from an Oracle database. Here tags for font, formatting is added before send to either the html-geberator or the rtf-generator. It is either converted to rtf for paper prints or to html for on screen display. I was thinking that you could use only of type of outputs (html) reading a CSS-file (maybe) for formatting and then generate the html (both for prints and for screen display)
I am working on a not-dissimilar effort this morning. Trying to achieve formatted printing could be done by writing rtf, but that format seems to have been largely replaced with various flavors of xml - for which there are several engines already written in Java or being devleoped as fast as people can write them. Seems to me xml in it's various incantations is very popular in Java right now, though which editor kit to use would have to be researched.

Originally Posted by Nicolai View Post
One could write to a temporary file that the browser should read using css-formatting (if this is possible). The browser should/could be started at the start of the application.
Memory resident files are well established in Java, maybe some of the Java genius we have around here can identifiy something in the swing classes we can begin with.

We have no shortage of gurus, your question is well worded.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 09-29-2008, 03:13 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,225
Rep Power: 4
Norm is on a distinguished road
Default
The simplest solution (too simple???) would be for the java program to create a disk file containing the HTML, CSS etc and start a browser to read and display that file. With this scheme, there is no interaction between the java app and the browser other than that the file read by the browser was written by the java app.
To start the browser after the file was written you would use the Process and Runtime classes.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 09-29-2008, 03:20 PM
Member
 
Join Date: Sep 2008
Posts: 4
Rep Power: 0
Nicolai is on a distinguished road
Default
Hi all.

Thanks alot for your answers.

Isn't the simplest solutions often the best???

I think that the solutions Norm highlights could be a nice solution.

I was just thinking how you could have this browser be an integrated part of the java-application then?

But most striking is the lack of support for rich formatting towards showing content in html form.

Thanks again.

Nicolai
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 10-06-2008, 11:41 AM
Member
 
Join Date: Sep 2008
Posts: 4
Rep Power: 0
Nicolai is on a distinguished road
Default
Hi again.

Getting back to issue about web browser.

Which browser would be a good choice? Would JxBrowser be a good choice?

Nicolai
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 10-06-2008, 04:01 PM
Nicholas Jordan's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 1,018
Rep Power: 3
Nicholas Jordan is on a distinguished road
Default
Excellent, really excellent.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Implement Search Functionality New2484 New To Java 2 08-27-2008 07:07 AM
Functionality of Buttons ljk8950 AWT / Swing 6 08-15-2008 01:44 PM
Embedding Word in an applet Java Tip SWT 0 07-25-2008 02:34 PM
A simple application to test the functionality of the OvalIcon class Java Tip java.awt 0 06-23-2008 11:16 PM
Change Password Functionality Priyadharshini.s Advanced Java 5 04-02-2008 12:56 PM


All times are GMT +2. The time now is 03:13 AM.



VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org