Hi all, as some of you might know the API is my nightmare. I know it's important and therefore I am trying to use it as much as I can. Today I am looking at a program that uses buttons to change the font of some text.
So, I have this line:
texField.setFont( new Font( "Serif", Font.PLAIN, 14) );
I looked in the API first for the setFont method in http://docs.oracle.com/javase/7/docs/api/javax/swing/JTextField.html and found this:

public void setFont(Font f)
Sets the current font. This removes cached row height and column width so the new font will be reflected. revalidate is called after setting the font.
setFont in class JComponent
f - the new font
See Also:

which is great. Then I moved to the Font class http://docs.oracle.com/javase/7/docs/api/java/awt/Font.html but what I was hoping to find was something like new Font(parameter1, parameter2, parameter3) which I did:

public Font(String name,
    int style,
    int size)

but I am not sure this is what I am looking for, and I think this is because of my inability to search throught the API (the second parameter in the code above - Font.PLAIN surely can't be an int!?)
I know this isn't a question as such, more a rant really, but I just find it very difficult to find my way across the API...

3 Years
Discussion Span
Last Post by Violet_82
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.