• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

simple web browser in java

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JEditorPane can't take Google search queries, why?..what are the other ways of doing it..i'm not interested in using api or browser instance..please tell me
Thanks for your valuable time
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Possibly because

Rob Spoor wrote:JEditorPane is hopelessly outdated as far as HTML support goes. It can only handle HTML 3.2. You'd better try a third party library like Lobo.


I am wondering why you have started a new thread. Isn't this related to your other thread here https://coderanch.com/t/530460/GUI/java/web-browser-project
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply Maneesh
is it possible to create at least HTML parser??
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No need to write a new one - check out libraries such as HtmlCleaner, NekoHtml, jTidy and TagSoup. Swing also has one called HTMLEditorToolkit or similar.
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to use HTML editor in web browser??
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, you asked how to create an HTML parser; the javax.swing.text.html.HTMLEditorKit class can be used to do that (I'm assuming you've read its javadocs by now).

How you plan to use that HTML parser is something you haven't told us. Should we take it that you still plan to build a Java browser? Since we've already established that a full browser that can handle all modern web pages is not feasible, what subset of functionality are you planning for it to have?
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for reply ulf..

Actually i'm in final year of engineering and as a final year project, i decided to create web browser.. and now i got to know that it is impossible for me to create web browser

i explained this fact to my college guide and he said that..this is new(interesting) project..so continue with same project..and create web browser up-to extent, possible for u..

now i'm confused how to proceed
pleaes explain me
which steps i should follow for creating web browser(very minimal functionality) from BEGINNING..
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
after fetching content from http server..is it possible to place controls according to that contents on application window...or any tool is available for it??
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Obviously it's possible - that's what web browsers do

You already know of two Java libraries/classes that do that - JEditorPane and Lobo. Source code for both is available, so you can study how they do it (to the extent that's allowed for your project work).
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
now i'm trying for other features in web browser..
1) refresh button- but how to stop loading the web page?
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how can i stop loading the page?? CODE
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are you using to start loading the page?
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i'm using URL object.. n setPage method of editorPane
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how can i stop loading the page?? CODE
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just terminate the thread that loads the page. (I'm assuming that you *are* using a separate thread for downloading a page, since that kind of thing should not be done in the UI thread. If you are not yet using a separate thread, start by making it so.)

CODE


If this a way of saying "Please point me to some code that does this."? If so, you may want to phrase it that way; as it is, it sounds a bit as if an order is given. Also note that JavaRanch is NotACodeMill.
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@ulf ya the way i asked was wrong.. but now i created a separate thread.. and now working on it
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want to check icon image of button at run time and according to it i need to take action.. i'm doing this for 'reload this page' and 'stop loading this page' as in google chrome Browser.. and based on result take the action.. but i'm not able to compare image icon.. following is the code that i'm trying:


 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code assumes that Icon.toString() returns file name; is that a correct assumption? And even if it is, does it look like the string you're comparing it to?

But more fundamentally, what is that comparison good for? Is this an event handler that handles several buttons? If so, why not give each button its own event handler, thus neatly avoiding such problems?
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@ulf it exactly prints the same thing when i try to use following code


but it is returning FALSE
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That being the case, make sure there's no whitespace or typos involved that would make comparison not succeed.
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how to change icon image of button at runtime??
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JButton class inherits a method that can be used for this; the method's name is highly suggestive.
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@ulf
which method??
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, if you're too lazy to browse the javadocs then I'm not willing to help.
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it's Okay.. i'm not at all lazy..i just asked..
but suggest me a way for saving the web page
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


at run time button icon is not visible??
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The generic answer to that would be to use the classes in the java.io package, particularly File and FileOutputStream. If you have a more specific question, please elaborate.
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want to provide a option save as as observed in web browser for saving the web page
 
Saloon Keeper
Posts: 15484
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ulf already pointed you to FileOutputStream. Another useful class for your purpose is JFileChooser.
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Stephan
Thanks for your reply
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


at runtime button icon is not visible??
 
Stephan van Hulst
Saloon Keeper
Posts: 15484
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your URL String is formatted incorrectly.
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please tell me what is wrong in it exactly..
 
Stephan van Hulst
Saloon Keeper
Posts: 15484
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://en.wikipedia.org/wiki/File_URI_scheme
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i tried to change format of ImageURL but of no use.....
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you going to tell us what you changed, or are we supposed to guess?
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please tell me what is wrong in this code


don't assume any thing
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How is that different from what you posted earlier? You said you changed something.

And it doesn't look like what's described in the page Stephan linked to.
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i tried various ways of writing image url given in link.. but no difference.. i tired it in following ways



 
Stephan van Hulst
Saloon Keeper
Posts: 15484
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure your image is located exactly where the URI says it is? You haven't got any typos?

If so, can you post an SSCCE showing your problem?
 
reply
    Bookmark Topic Watch Topic
  • New Topic