• Post Reply Bookmark Topic Watch Topic
  • New Topic

loading text area into a panel

 
oghenekaro EFEKODO
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pls,am having problems trying to put text area into JPanel.pls how can i do it.i did this and it didn't work.

JPanel p=new JPanel();
p.add(new JScrollPane(new JTextArea(50,50)));
 
Nick Meverden
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.swing.JFrame frame = new javax.swing.JFrame("TEST");
frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();

javax.swing.JPanel p = new javax.swing.JPanel();
javax.swing.JTextArea tArea = new javax.swing.JTextArea(50,50);
p.add(new javax.swing.JScrollPane(tArea));

tArea.setText("TEST");

frame.getContentPane().add(p);

frame.setBounds((screenSize.width-600)/2, (screenSize.height-400)/2, 600, 400);

frame.setVisible(true);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!