I am writing a little program that draws circles inside a JPanel. I put the Jpanel inside a JScrollPane, but when the circles are bigger than the area, it wont scroll. Why is this happening? thanks cardwell
posted 14 years ago
Hi Cardwell, The JScrollPane asks the JPanel what size it would prefer to be and uses that size. Your circles are not objects that need to be managed therefore the JPanel layout doesn't use them to give its' preferred size. You need to set the JPanel preferred size so that the JScrollPane knows that it is not the same size as its child (JPanel). Regards, Manfred.