Changing elements in a JScrollPane

Hi all,

I was wondering, is it possible to change the elements inside a JScrollPane. That is, say I had two buttons A and B. If I press button A, I would like the JScrollPane to display a JLabel in it, but If I press button B, I would like the scroll pane to display a JTree in it. All using the same scroll pane of course. Is this sort of functionality possible?

Thanks in advance.

[401 byte] By [ehwhoknowsa] at [2007-10-3 2:52:22]
# 1
scrollPane.getViewport().setView(...);
camickra at 2007-7-14 20:41:20 > top of Java-index,Desktop,Core GUI APIs...