I have loaded a org.w3c.dom
dom document on to the component.
I want to get each element开发者_开发知识库 to highlight.
For example, on mouseover, I would get the element from this point and then get the dimension of this element so that I can create a Jframe on top of this element with a colored border.
Is it possible to get an element's height and width?
The DOM API doesn't really handle HTML or rendering, it's a pure representation of the elements of an XML element.
Those elements have no inherent size (or color, or z-index, ...).
If you want that information, you'd need to have some component that actually renders your document (or at least produces a layout that could be rendered).
Is there such a component in your application? Is your code running as an Applet in a browser?
精彩评论