The following code works when the font line is commented out, and no GUI appears at all when the line is included. From what I can tell its formatted properly but its crashing the GUI. What could cause this?
public class TestCode extends JFrame{
JTextArea jta;
public TestCode(){
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
JPanel content = new JPanel();
jta = new JTextArea(20, 30);
jta.setFont(new Font("Courier New", Font.PLAIN, 12)); // This line crashes
content.add(jta);
add(content);
pack();
setVisible(true);
}
public static void main (String [] args){
TestCode run = new TestCode();
}
}
I'm beginning to suspect that it has something to do with my system fonts? I have installed extra fonts, perhaps that affects Java's ability to retrieve them?
EDIT:
Just to clarify, there are no errors when I run this program. The GUI never opens and the IDE gets slow and buggy as if I were running an infinite loop. The program must be terminated via the IDE (because no GUI shows to close).