JFrame is not acting as expected!

Posted by DasWood on Stack Overflow See other posts from Stack Overflow or by DasWood
Published on 2010-04-29T12:53:10Z Indexed on 2010/04/29 12:57 UTC
Read the original article Hit count: 283

Filed under:
|

This is my first time using a JFrame. I can't get the window to display the text areas I've nested inside the JFrame. I am trying to get the text field with my name in it to display above the tabulated results, which I have omitted the formatting for until I can get the JFrame to work.

public void printResults(String[] names, int[] temp, int[][] scores, float[] averages, char[] letters){

JTextArea outarea= new JTextArea(5,20);
JTextArea name = new JTextArea(5,20);
Font font = new Font("Tahoma", Font.BOLD, 48);
name.setFont(font);
name.setText("Made By Durka Durka");

JFrame window = new JFrame();
window.getContentPane().add(name);
window.getContentPane().add(outarea);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.pack();
window.getContentPane().setVisible(true)

String out = "twat";

outarea.setText(out);


//JOptionPane.showMessageDialog(null,window);

}

© Stack Overflow or respective owner

Related posts about jframe

Related posts about java