Layout Overlapping problems

hi all, I've created a JScrollPane which consists of a JTextPane. When i filled the JtextPane with String over the preferredSize, The JScrollPane Shows up, which means , it works fine. however, if i try to click on other area of the interface, the JtextPane overlap the whole interface, and the JScrollPane not showing up anymore. Help...I cant fix this problem for weeks.

[380 byte] By [don.juan9a] at [2007-11-27 10:11:15]
# 1

> hi all, I've created a JScrollPane which consists of

> a JTextPane. ......

Without your code, I can only guess. And I am going to guess blue..... no yel....... Auuuuuuuuuuuuuuuuuuuuugh!!!!!!!!!!!

petes1234a at 2007-7-28 15:12:00 > top of Java-index,Java Essentials,Java Programming...
# 2

haha...sori2...here is my code:

D = new JPanel (new BorderLayout());

................

textPane = new JTextPane(document);

textPane.setEditable(false);

dim = new Dimension();

dim.setSize(300, 450);//width and height

textPane.setPreferredSize(dim);

JScrollPane scrollPane = new JScrollPane(textPane);

scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

D.add(scrollPane,BorderLayout.CENTER);

don.juan9a at 2007-7-28 15:12:00 > top of Java-index,Java Essentials,Java Programming...
# 3

You're going to need to post a SSCCE. Read here on how to create this:

http://homepage1.nifty.com/algafield/sscce.html

Also, since this is a Swing problem, you may have a better chance of getting a useful response by posting in that forum. If you do, please reference that post here and this post there so folks don't waste time answer questions that have already been answered. Good luck.

petes1234a at 2007-7-28 15:12:00 > top of Java-index,Java Essentials,Java Programming...