File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes simple web browser in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "simple web browser in java" Watch "simple web browser in java" New topic
Author

simple web browser in java

harshada patil
Ranch Hand

Joined: Mar 12, 2011
Posts: 96
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
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10426
    
    8

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 http://www.coderanch.com/t/530460/GUI/java/web-browser-project


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

Joined: Mar 12, 2011
Posts: 96
Thanks for your reply Maneesh
is it possible to create at least HTML parser??
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
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.


Ping & DNS - my free Android networking tools app
harshada patil
Ranch Hand

Joined: Mar 12, 2011
Posts: 96
How to use HTML editor in web browser??
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
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

Joined: Mar 12, 2011
Posts: 96
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

Joined: Mar 12, 2011
Posts: 96
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
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
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

Joined: Mar 12, 2011
Posts: 96
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

Joined: Mar 12, 2011
Posts: 96
how can i stop loading the page?? CODE
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

What are you using to start loading the page?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
harshada patil
Ranch Hand

Joined: Mar 12, 2011
Posts: 96
i'm using URL object.. n setPage method of editorPane
harshada patil
Ranch Hand

Joined: Mar 12, 2011
Posts: 96
how can i stop loading the page?? CODE
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
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

Joined: Mar 12, 2011
Posts: 96
@ulf ya the way i asked was wrong.. but now i created a separate thread.. and now working on it
harshada patil
Ranch Hand

Joined: Mar 12, 2011
Posts: 96
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
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
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

Joined: Mar 12, 2011
Posts: 96
@ulf it exactly prints the same thing when i try to use following code


but it is returning FALSE
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
That being the case, make sure there's no whitespace or typos involved that would make comparison not succeed.
harshada patil
Ranch Hand

Joined: Mar 12, 2011
Posts: 96
how to change icon image of button at runtime??
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
The JButton class inherits a method that can be used for this; the method's name is highly suggestive.
harshada patil
Ranch Hand

Joined: Mar 12, 2011
Posts: 96
@ulf
which method??
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
Sorry, if you're too lazy to browse the javadocs then I'm not willing to help.
harshada patil
Ranch Hand

Joined: Mar 12, 2011
Posts: 96
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

Joined: Mar 12, 2011
Posts: 96


at run time button icon is not visible??
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
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

Joined: Mar 12, 2011
Posts: 96
i want to provide a option save as as observed in web browser for saving the web page
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  16

Ulf already pointed you to FileOutputStream. Another useful class for your purpose is JFileChooser.
harshada patil
Ranch Hand

Joined: Mar 12, 2011
Posts: 96
@Stephan
Thanks for your reply
harshada patil
Ranch Hand

Joined: Mar 12, 2011
Posts: 96


at runtime button icon is not visible??
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  16

Your URL String is formatted incorrectly.
harshada patil
Ranch Hand

Joined: Mar 12, 2011
Posts: 96
please tell me what is wrong in it exactly..
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  16

http://en.wikipedia.org/wiki/File_URI_scheme
harshada patil
Ranch Hand

Joined: Mar 12, 2011
Posts: 96
i tried to change format of ImageURL but of no use.....
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
Are you going to tell us what you changed, or are we supposed to guess?
harshada patil
Ranch Hand

Joined: Mar 12, 2011
Posts: 96
please tell me what is wrong in this code


don't assume any thing
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
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

Joined: Mar 12, 2011
Posts: 96
i tried various ways of writing image url given in link.. but no difference.. i tired it in following ways



Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  16

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?
 
wood burning stoves
 
subject: simple web browser in java