Scroll bar does not retain its position after or before pack

Hi

My Scroll bar does not retain its position after pack in my application.

But i need to retain its state.

My code snippet is :

System.out.println("VAlue>" + getHXValue());

scrollPane.getHorizontalScrollBar().setValue(getHXValue());

pack();

My VAlue printed is 100.

But my positon of scroll bar is at 0 th location.

Can any one help me.....

[405 byte] By [rose@rosea] at [2007-11-27 8:59:54]
# 1
Can you set the position after calling pack()?
hunter9000a at 2007-7-12 21:27:58 > top of Java-index,Java Essentials,Java Programming...
# 2

Swing related questions should be posted in the Swing forum.

> My code snippet is :

Snippets don't help.

If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",

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

that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

Don't forget to use the "Code Formatting Tags",

see http://forum.java.sun.com/help.jspa?sec=formatting,

so the posted code retains its original formatting.

camickra at 2007-7-12 21:27:58 > top of Java-index,Java Essentials,Java Programming...
# 3
ya i set it after pack() also.But it is not retaining its value
rose@rosea at 2007-7-12 21:27:58 > top of Java-index,Java Essentials,Java Programming...