For Programmers: Free Programming Magazines  


Home > Archive > Java Help > February 2005 > can paint panel scrollable ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author can paint panel scrollable ?
javaSwing

2005-02-24, 4:01 pm

problem is:

a JPanel is 300 width and 300 height
now i draw some graphics(not image) on this panel using
paintComponent(..) method
but the graphics get a size of 300x400.
the JPanel is set resizeable to false, so how to display the graphics
properly ?

klynn47@comcast.net

2005-02-24, 8:59 pm

I would suggest creating a JScrollPane and adding the panel to it.
Whenever you draw on the panel, reset the preferred size and revalidate
it so that if you can't see all of the things you've drawn, there will
be scrollbars so that you can scroll to see everything on the panel.

javaSwing

2005-02-25, 8:59 am

thanks, i'll try it

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com