TextField firstnamebox = new TextField(gc, new Font("Arial", Font.ITALIC, 16), 150, 245, 450, 40);
Eclipse says that the constructor for TextField is undefined.
What’s wrong?
TextField firstnamebox = new TextField(gc, new Font("Arial", Font.ITALIC, 16), 150, 245, 450, 40);
Eclipse says that the constructor for TextField is undefined.
What’s wrong?
Would it be:
JTextField?
same as
JTextArea?
Not as in the same purpose, but in the same meaning with a “J” infront.
That means it can’t find that constructor…
EDIT: @GabrielBailey74 I see the “gc”, which reminds of GameContainer, which means this is Slick.
EDIT2: @OP After a bit of digging, I found the TextField class in Slick: http://slick.cokeandcode.com/javadoc/org/newdawn/slick/gui/TextField.html
import org.newdawn.slick.gui.*;
At the top of the code.
It looks like your code is fine, since it matches up to the first TextField constructor specified.
Yup. I use it in the TrueTypeFont constructor right above it.
Edit. Oh! Okay.
OH! It looks like you’re using the java.awt.Font! You cannot use AWT at all here, instead you need an instance of a class that implements org.newdawn.slick.Font. You can only use AngelCodeFont, SpriteSheetFont, TrueTypeFont, or UnicodeFont.
You can still use a Java font as a parameter in TrueTypeFont if need be. I’ve done it a few times myself.
font = new TrueTypeFont(new java.awt.Font("Verdana",
java.awt.Font.PLAIN, 14), true);
Then you would set the font the same as you would any other way.
~Shazer2