By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,470 Members | 1,907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,470 IT Pros & Developers. It's quick & easy.

JTextArea not appearing?

P: n/a
I haven't done any Java programming for a good long bit, so this is probably
something really silly but anyways, can anyone tell me why my JTextArea is
not appearing when I run this?

public class MyApp extends JFrame {
JTextArea textArea;

public MyApp() {
getContentPane().setLayout(null);

textArea = new JTextArea();
textArea.setColumns(300);
textArea.setRows(10);
textArea.setLocation(120, 5);
textArea.setVisible(true);

getContentPane().add(textArea);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(500, 500);
setVisible(true);
}

public static void main(String args[]) {
MyApp win = new MyApp();
}
}
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Chris Williams" <ch***@dwango.com> wrote in message
news:bp********@dispatch.concentric.net...
I haven't done any Java programming for a good long bit,
so this is probably something really silly but anyways, can
anyone tell me why my JTextArea is not appearing when
I run this?

public class MyApp extends JFrame {
JTextArea textArea;

public MyApp() {
getContentPane().setLayout(null);

textArea = new JTextArea();
textArea.setColumns(300);
textArea.setRows(10);
textArea.setLocation(120, 5);
textArea.setVisible(true);

getContentPane().add(textArea);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(500, 500);
setVisible(true);
}

public static void main(String args[]) {
MyApp win = new MyApp();
}
}


Remove this line:

getContentPane().setLayout(null);

Also, this:

textArea.setVisible(true);

is unnecessary, but benign.

I hope this helps.

Anthony Borla
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.