I have an applet with a JTabbedPane .
One of the tabs has a JPanel on which I draw using the Graphics g
context.
Since the diagram turns out to be very large I tried adding a
JScrollPane to this JPanel using code
------------------------------------------------------------
JScrollPane myScroll = new JScrollPane( myPanel ) ;
------------------------------------------------------------
but the scroll bars do not show up.
I also tried
-----------------------------------------------------------
JScrollPane myScroll = new JScrollPane( mapArea ,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS) ;
--------------------------------------------------------------
but still no result
can anyone please help me.
Thanks in advance
chetan
Babu Kalakrishnan - 10 Feb 2005 07:35 GMT
> I have an applet with a JTabbedPane .
> One of the tabs has a JPanel on which I draw using the Graphics g
[quoted text clipped - 9 lines]
>
> but the scroll bars do not show up.
a) Make sure that your panel has a preferredSize parameter which
reflects its true size. (Call setPreferredSize)
b) Ensure that you add "myScroll" to the JTabbedPane and not "myPanel".
If you do the latter, it will be automatically removed from its existing
parent - namely the JScrollPane's viewport.
BK