Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

paintComponent(Graphics) not being called on a JPanel in a JScrollPane

Status
Not open for further replies.

rsfoley

Programmer
Apr 16, 2002
56
US
(I am using JDK 1.4.0)

I have a JPanel that implements Scrollable and I add it to a JScrollPane. The scroll bars show up and act correctly, however the JPanel's paintComponent(Graphics) method is not being called.

If I take the JScrollPane out of the problem there is no problem. The JPanel's paintComponent method is getting called just fine. If I put my own JScrollBars and implement them they scroll the panel contents just fine. It would be more efficient to use the Scrollable interface and a JScrollPane.

Does anyone know why paintComponent on a JPanel would not be getting called when I added to a JScrollPane?
 
I fixed my problem as it turns out I was doing something incorrect. I was overriding the setSize methods for an unrelated reason. So no need for replies.

Thanks...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top