On the meaning of the documentation for a newbie
I'm finding that the Java documentation is exceptionally good compared to most programming languages I've learned. But even so, most of it is pretty meaningless to a newbie. Case in point. I'm trying to figure out how to use "read()" on a JTextPane. The documentation gives:
public void read(InputStream in,
Object desc)
Parameters:
in - the stream from which to read
desc - an object describing the stream
Let's consider that phrase "an object describing the stream". To a newbie that phrase is completely empty of meaning. What kind of "description" is being called for by the method? "It's a deep blue with silver accents and a darling little white lace ruffle around the edges". Well, I'd hazard a guess that a description like that wouldn't satisfy the method, but what sort of description would? And where, if not in the method's documentation, do I go to find out what kind of description is needed?
Looking up the description's class "Object" is obviously of no help. Of course once you know all that stuff then you don't really need the documentation, but before you know all there is to know about Java it seems like the only way to find an answer is to know the answer already.
(As frustrating as I find this, at least it's not as bad as the years and years I spent mastering C++ and the Windows API. Now THAT's the true definition of the word "frustration".)
--gary
[1451 byte] By [
fiziwiga] at [2007-10-3 2:53:05]

Yes, I know. They're pretty good. But it seems like just about everything I've tried to look up since completing the tutorials just isn't to be found anywhere. Like how to get an String containing HTML into a JTextPane. No examples of THAT in the tutorials. You'd think that since there's a JTextPane.setText(), there would also be a JTextPane.setHTMLText(). But there isn't.
JTextPane.read() says it renders the HTML into the JTextPane, but it doesn't when I run it. No examples of that in the tutorial either. (It probably has something to do with that mysterious "desc" parameter in the read method, which I've just set to "null", since it didn't compile when I set it to anything else I tried.)
Oh well. Eventually I'll figure it all out. But in the meantime, I spend hours and hours Googling for answers that just can't be found.
--gary
> You aren't trying very hard. A google search using
> "jtextpane html" turns up all kinds of references -
<snip>
> The rest of the search listing is right on the nose,
> also.
Thanks for those suggestions. However, I already found those pages days ago, and I've already read all the tutorials, and my specific question is NOT answered by any of those pages.
How do I get a String object which contains an HTML document into a JTextPane.
The examples in the tutorial and the other search pages that Google brings up do NOT address that issue, they only address the issue of loading a URL into the JTextPane.
Hence, my question, which is NOT answered in the tutorials.
--gary
Thanks, that put me on the right track.
I'm afraid experienced Java folks have no idea how confusing the documentation is to a newbie. Even a newbie like me with several decades of programming experience.
On the other hand, I've watched newbies to C++ and just been incredulous at how they could fail to understand some patently obvious concept. Familiarity breeds comtempt. Specifically, it breeds contempt for the newbie who really should, if he had half a brain, be able to see the obvious answer for himself.
But alas, the newbie does not yet grasp the larger context in which such "obvious" answers become truly obvious.
--gary
The "read" in the superclass (JTextComponent) has a longer description of "desc":
desc - an object describing the stream; this might be a string, a File, a URL, etc. Some kinds of documents (such as html for example) might be able to make use of this information; if non-null, it is added as a property of the document
MLRona at 2007-7-14 20:42:09 >
