• Post Reply Bookmark Topic Watch Topic
  • New Topic

JScrollPane does not work with JTextArea  RSS feed

 
Ashok Pradhan
Ranch Hand
Posts: 180
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my program I have a JTextArea and added in a JScrollPane but it does not work :-

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you have a number of things wrong

frm.setLayout(null);

means you are responsible for the sizing/location,
and the scrollpane has none


frm.getContentPane().add(scroll);
frm.getContentPane().add(area);

'area' cannot be in 2 places at the same time
1) added to the scrollpane
2) added to the contentPane

get rid of the null layout, just get the scrollpane working,
then worry about the look of it later
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!