Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   need help with javadocs (http://www.velocityreviews.com/forums/t945818-need-help-with-javadocs.html)

bilsch 04-28-2012 11:25 PM

need help with javadocs
 
Several times I've visited Oracle site to browse the class library
documentation but I never come away with information that satisfied my
curiosity. Here's an example. If someone leads me through this example
it may get me moving through javadocs successfully.

EXAMPLE:
I have a book with the following a statement:
Font f = new Font("TimesRoman", Font.Bold, 36);
The book says that Font is from the java.awt package. I understand what
the statement does, but I don't know where to find a list of the
parameters that Font can work with, for instance I would assume
("CourierNew", Font.Italic, 12) will work, but where is this information
listed? Even more important, where will the documentation tell me what
kind of information goes in the =new Font(a, b, c) part of the
statement. Instead of a, b and c why not w, x, y and z? Where does the
documentation tell me the kind and number of parameters that go inside
the parentheses in Font f = new Font()?

TIA Bill S.



Arne Vajhøj 04-28-2012 11:48 PM

Re: need help with javadocs
 
On 4/28/2012 7:25 PM, bilsch wrote:
> Several times I've visited Oracle site to browse the class library
> documentation but I never come away with information that satisfied my
> curiosity. Here's an example. If someone leads me through this example
> it may get me moving through javadocs successfully.
>
> EXAMPLE:
> I have a book with the following a statement:
> Font f = new Font("TimesRoman", Font.Bold, 36);
> The book says that Font is from the java.awt package. I understand what
> the statement does, but I don't know where to find a list of the
> parameters that Font can work with, for instance I would assume
> ("CourierNew", Font.Italic, 12) will work, but where is this information
> listed? Even more important, where will the documentation tell me what
> kind of information goes in the =new Font(a, b, c) part of the
> statement. Instead of a, b and c why not w, x, y and z? Where does the
> documentation tell me the kind and number of parameters that go inside
> the parentheses in Font f = new Font()?


????

http://docs.oracle.com/javase/6/docs...0int,%20int%29

has plenty of information.

Arne


Daniel Pitts 04-28-2012 11:49 PM

Re: need help with javadocs
 
On 4/28/12 4:25 PM, bilsch wrote:
> Several times I've visited Oracle site to browse the class library
> documentation but I never come away with information that satisfied my
> curiosity. Here's an example. If someone leads me through this example
> it may get me moving through javadocs successfully.
>
> EXAMPLE:
> I have a book with the following a statement:
> Font f = new Font("TimesRoman", Font.Bold, 36);
> The book says that Font is from the java.awt package. I understand what
> the statement does, but I don't know where to find a list of the
> parameters that Font can work with, for instance I would assume
> ("CourierNew", Font.Italic, 12) will work, but where is this information
> listed? Even more important, where will the documentation tell me what
> kind of information goes in the =new Font(a, b, c) part of the
> statement. Instead of a, b and c why not w, x, y and z? Where does the
> documentation tell me the kind and number of parameters that go inside
> the parentheses in Font f = new Font()?
>
> TIA Bill S.
>
>

If you do a google search for 'java.awt.font 1.6', you'll likely come
across this page:

docs.oracle.com/javase/6/docs/api/java/awt/Font.html

This is the javadoc for Font. It includes details for the Font
constructor (which is what you were looking at).

HTH,
Daniel.

Stefan Ram 04-28-2012 11:49 PM

Re: need help with javadocs
 
bilsch <king621@comcast.net> writes:
>I understand what the statement does, but I don't know where
>to find a list of the parameters that Font can work with


In the documentation of »java,awt,Font«, see »Constructor Summary«.
Also, read Java textbooks about instance creation expressions (JLS 15.9).


Martin Gregorie 04-29-2012 12:05 AM

Re: need help with javadocs
 
On Sat, 28 Apr 2012 16:25:48 -0700, bilsch wrote:

> Several times I've visited Oracle site to browse the class library
> documentation but I never come away with information that satisfied my
> curiosity. Here's an example. If someone leads me through this example
> it may get me moving through javadocs successfully.
>
> EXAMPLE:
> I have a book with the following a statement:
> Font f = new Font("TimesRoman", Font.Bold, 36);
> The book says that Font is from the java.awt package. I understand what
> the statement does, but I don't know where to find a list of the
> parameters that Font can work with, for instance I would assume
> ("CourierNew", Font.Italic, 12) will work, but where is this information
> listed? Even more important, where will the documentation tell me what
> kind of information goes in the =new Font(a, b, c) part of the
> statement. Instead of a, b and c why not w, x, y and z? Where does the
> documentation tell me the kind and number of parameters that go inside
> the parentheses in Font f = new Font()?
>

Its available from the Oracle Java downloads page. The 'Documentation'
tab lets you access an online copy and see what the main Java Library
Javadocs look like. You can also download and install a local copy from
the 'Downloads' tab - its at the bottom of the page in the 'Additional
Resources' table. I think its worth having a local copy, but it is big -
last time I made the comparison the documentation download was bigger
than the matching Java SE JDK download.


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |

John B. Matthews 04-29-2012 04:10 AM

Re: need help with javadocs
 
In article <jnhu9t$19n$1@dont-email.me>, bilsch <king621@comcast.net>
wrote:

> I understand what the statement does, but I don't know where to find
> a list of the parameters that Font can work with. For instance. I
> would assume ("CourierNew", Font.Italic, 12) will work, but where is
> this information listed?


The documentation for java.awt.Font addresses this issue by
distinguishing between physical and logical fonts. The former have
particular names and availability, while the latter have been mapped to
installed fonts on a given platform.

Rather than "Courier", consider the implementation's monospaced font:

Font f = new Font(Font.MONOSPACED, Font.Italic, 12);

For larger point sizes, consider the available sans serif font:

Font f = new Font(Font.SANS_SERIF, Font.Bold, 36);

Also, be aware of the several variations of deriveFont().

More details may be found in the tutorial:

<http://docs.oracle.com/javase/tutorial/2d/text/fonts.html>

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

Lew 04-29-2012 04:14 AM

Re: need help with javadocs
 
John B. Matthews wrote:
> bilsch wrote:
>> I understand what the statement does, but I don't know where to find
>> a list of the parameters that Font can work with. For instance. I
>> would assume ("CourierNew", Font.Italic, 12) will work, but where is
>> this information listed?

>
> The documentation for java.awt.Font addresses this issue by
> distinguishing between physical and logical fonts. The former have
> particular names and availability, while the latter have been mapped to
> installed fonts on a given platform.
>
> Rather than "Courier", consider the implementation's monospaced font:
>
> Font f = new Font(Font.MONOSPACED, Font.Italic, 12);
>
> For larger point sizes, consider the available sans serif font:
>
> Font f = new Font(Font.SANS_SERIF, Font.Bold, 36);
>
> Also, be aware of the several variations of deriveFont().
>
> More details may be found in the tutorial:
>
> <http://docs.oracle.com/javase/tutorial/2d/text/fonts.html>


Picking up on this, and repeating some of what those references try to teach,
the actual fonts on any given system vary. Just like you might or might not
find a particular file on any given hard drive, you might or might not find a
particular font there.

The physical fonts to which John alludes are the uncertain ones, though many
such as "Courier" are so widespread as to be fairly reliable. The logical
fonts are the ones Java guarantees to be present, but you might find them dull
and boring.

If you want to play with physical fonts you'll need some means of what's
called "discovery" - a way for the software to read the system or some
configuration to find out what's there.

You should have the Javdocs bookmarked and refer to them often.

As in many times a day.

--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedi.../c/cf/Friz.jpg

Jukka Lahtinen 04-29-2012 09:00 AM

Re: need help with javadocs
 
Lew <noone@lewscanon.com> writes:

> If you want to play with physical fonts you'll need some means of what's
> called "discovery" - a way for the software to read the system or some
> configuration to find out what's there.


...and when you (the OP) read the javadoc documentation of the
constructor Font(String, int, int) you should find there a "See also"
link that tells you how to do that.

--
Jukka Lahtinen

Roedy Green 04-29-2012 02:39 PM

Re: need help with javadocs
 
On Sat, 28 Apr 2012 16:25:48 -0700, bilsch <king621@comcast.net>
wrote, quoted or indirectly quoted someone who said :

>The book says that Font is from the java.awt package.


1. Try looking up the puzzling word or class in the Java glossary.
If you don't find it, complain to me. See
http://mindprod.com/jgloss/jgloss.html in this case "Font". It will
tell a newbie all the important things to know about Font, with some
sample code. It will also tell you how to acquire and install fonts.
Under "learning more" It will also provide you a link both to Oracle's
JavaDoc for the Font class and to a local copy, provided you have put
the download in
J:\Program Files\java\jdk1.7.0_04\docs
To get the documentation download see
http://mindprod.com/jgloss/jdk.html
You can put it on E: for example, and set up a J: alias. See
http://mindprod.com/jgloss/jdrive.

2. go to
http://docs.oracle.com/javase/7/docs...s-noframe.html
Find the class you want. You don't need to know the package.
Make a bookmark

3. go to
http://docs.oracle.com/javase/7/docs...w-summary.html
find the package you want. Look for the class inside that. Look for
the constructor and methods inside that.
Make a bookmark.

If you lose these bookmarks, look up either class or package in the
Java glossary and look under "Learning More".

--
Roedy Green Canadian Mind Products
http://mindprod.com
Programmers love to create simplified replacements for HTML.
They forget that the simplest language is the one you
already know. They also forget that their simple little
markup language will bit by bit become even more convoluted
and complicated than HTML because of the unplanned way it grows.
..

Roedy Green 04-29-2012 02:47 PM

Re: need help with javadocs
 
On Sun, 29 Apr 2012 00:10:31 -0400, "John B. Matthews"
<nospam@nospam.invalid> wrote, quoted or indirectly quoted someone who
said :

>
>The documentation for java.awt.Font addresses this issue by
>distinguishing between physical and logical fonts. The former have
>particular names and availability, while the latter have been mapped to
>installed fonts on a given platform.


You can fairly easily roll your own fancier logical fonts.
see
https://wush.net/websvn/mindprod/fil...ntFactory.java

You figure out which platform, you have, what fonts are available, and
decide on a set of fonts to use as your basic set. This way they can
be a little more interesting than the logical fonts.
--
Roedy Green Canadian Mind Products
http://mindprod.com
Programmers love to create simplified replacements for HTML.
They forget that the simplest language is the one you
already know. They also forget that their simple little
markup language will bit by bit become even more convoluted
and complicated than HTML because of the unplanned way it grows.
..


All times are GMT. The time now is 11:31 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.