This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Scroll pane problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Scroll pane problem" Watch "Scroll pane problem" New topic

Scroll pane problem

Peter Phung
Ranch Hand

Joined: Dec 06, 2001
Posts: 138
How do i make a scroll pane a specified size?
i've created a JTextArea and have placed it in a scrollpane. However, when the textarea and scrollpane is displayed it appears smaller than i want it?
Here's the code i have :

I'd appreciate any help that anyone can offer.

Pete<br />"Reality is an illusion <br />brought on by a lack of <br />drink, drugs and smut"
Rajendar Goud
Ranch Hand

Joined: Mar 06, 2002
Posts: 220
Try this..
textArea = new JTextArea(5, 30);
JScrollPane scrollPane = new JScrollPane(textArea);
contentPane.setPreferredSize(new Dimension(400, 100));
contentPane.add(scrollPane, BorderLayout.CENTER);

I agree. Here's the link:
subject: Scroll pane problem
Similar Threads
How to copy from 4 JTextFields to 1 JTextArea
Can't make JTableHeader reorderingAllowed
No Scroll Bar coming in JTextArea
JButton and opening new window