im having problems trying to load a font and display a string. all i seem to get is a little red blob.
heres the source code.
import java.io.;
import java.awt.;
import java.awt.event.*;
// font found @ http://www.1001fonts.com/fonts/win/ttf/2932/myscars.zip
class FrameResponce extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
class FrameExt extends Frame
{
private Font gameFont;
public FrameExt()
{
try
{
gameFont = Font.createFont(Font.TRUETYPE_FONT,new File("MYSCARS_.ttf"));
setTitle("Font Test");
setSize(640,480);
setResizable(false);
addWindowListener(new FrameResponce());
setVisible(true);
}
catch(Exception e)
{
System.out.println("*** Exception ***");
System.out.println("Message: "+e.getMessage());
System.out.println("Cause: "+e.getCause());
System.exit(0);
}
}
public void paint(Graphics g)
{
g.setColor(Color.black);
g.fillRect(0,0,getWidth(),getHeight());
g.setColor(Color.red);
g.setFont(gameFont);
gameFont.deriveFont(64.0f);
g.drawString("Loading...",getWidth()/2,getHeight()/2);
}
}
class FontTest
{
public static void main(String arg[])
{
FrameExt fext = new FrameExt();
}
}