need help with javadocs

Discussion in 'Java' started by bilsch, Apr 29, 2012.

  1. bilsch

    bilsch Guest

    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.
     
    bilsch, Apr 29, 2012
    #1
    1. Advertising

  2. bilsch

    Arne Vajhøj Guest

    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/api/java/awt/Font.html#Font(java.lang.String, int, int)

    has plenty of information.

    Arne
     
    Arne Vajhøj, Apr 29, 2012
    #2
    1. Advertising

  3. bilsch

    Daniel Pitts Guest

    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.
     
    Daniel Pitts, Apr 29, 2012
    #3
  4. bilsch

    Stefan Ram Guest

    bilsch <> 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).
     
    Stefan Ram, Apr 29, 2012
    #4
  5. 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 |
     
    Martin Gregorie, Apr 29, 2012
    #5
  6. In article <jnhu9t$19n$>, 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>

    --
    John B. Matthews
    trashgod at gmail dot com
    <http://sites.google.com/site/drjohnbmatthews>
     
    John B. Matthews, Apr 29, 2012
    #6
  7. bilsch

    Lew Guest

    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/wikipedia/commons/c/cf/Friz.jpg
     
    Lew, Apr 29, 2012
    #7
  8. Lew <> 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
     
    Jukka Lahtinen, Apr 29, 2012
    #8
  9. bilsch

    Roedy Green Guest

    On Sat, 28 Apr 2012 16:25:48 -0700, bilsch <>
    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/api/allclasses-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/api/overview-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, Apr 29, 2012
    #9
  10. bilsch

    Roedy Green Guest

    On Sun, 29 Apr 2012 00:10:31 -0400, "John B. Matthews"
    <> 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/fi...&path=/com/mindprod/common11/FontFactory.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.
    ..
     
    Roedy Green, Apr 29, 2012
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ashish

    javadocs equivalent for .net

    ashish, Apr 15, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    628
    Maxim Kazitov
    Apr 16, 2004
  2. Dan W
    Replies:
    2
    Views:
    328
    Carlton S. Anderson
    Jul 15, 2003
  3. Ahmed Moustafa
    Replies:
    3
    Views:
    386
    Ahmed Moustafa
    Sep 5, 2003
  4. Torsten Nahm
    Replies:
    0
    Views:
    449
    Torsten Nahm
    Nov 7, 2003
  5. James Bond
    Replies:
    0
    Views:
    541
    James Bond
    Aug 3, 2004
Loading...

Share This Page