Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Highlighting arbitrary portions of a webpage

0 views
Skip to first unread message

Elliott

unread,
Nov 6, 2009, 6:16:15 PM11/6/09
to
I have a program that allows users to view images and then, by
dragging their mouse accross portions of the image, draw a box around
the portion and add a note that describes that part of the picture
(sites like Flickr allow similar functionality). The problem with
the function as it stands today is that it only works if what is
loaded into the window is a URL that is some kind an image (e.g. a
tiff or gif or bmp file, etc.). What I would like to do is be able
to navigate to any arbitrary web page (e.g. www.google.com) and allow
users the ability to annotate in the same manner. It would be great
if I could do this as part of a java applet but javascript is also a
possibility. Any ideas on how to do this?

John B. Matthews

unread,
Nov 6, 2009, 10:40:42 PM11/6/09
to
In article
<62dfc372-a04a-44b2...@f10g2000vbl.googlegroups.com>,
Elliott <efam...@hotmail.com> wrote:

Consider using a JEditorPane [1] to display an HTMLDocument [2].
JTextComponents, like JEditorPane, have methods to obtain the
selection start and end, which may be of use. You might look at the Sun
tutorial on "Using Text Components" [3] and "How to Use Editor Panes
and Text Panes" [4].

[1]<http://java.sun.com/javase/6/docs/api/javax/swing/JEditorPane.html>
[2]<http://java.sun.com/javase/6/docs/api/javax/swing/text/html/HTMLDocument.html>
[3]<http://java.sun.com/docs/books/tutorial/uiswing/components/text.html>
[4]<http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html>

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

Roedy Green

unread,
Nov 8, 2009, 8:57:01 AM11/8/09
to
On Fri, 6 Nov 2009 15:16:15 -0800 (PST), Elliott
<efam...@hotmail.com> wrote, quoted or indirectly quoted someone who
said :

Marking text with a CSS class will insist you insert your markers in a
balanced way, so you would have to mark a arbitrary string with a
number of sub pieces.

If you rendered your own HTML, you could do what you wanted, but then
your browser will not be tolerant to erroneous HTML or new syntax.

If you somehow ran a browser in the background, you might be able to
capture its output and repaint it with your decorations. This is the
approach I think would have most chance of success.
--
Roedy Green Canadian Mind Products
http://mindprod.com

Without deviation from the norm, progress is not possible.
~ Frank Zappa (born: 1940-12-21 died: 1993-12-04 at age: 52)

0 new messages