Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to add a JPanel & JList to a JSrollPane  RSS feed

 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JList which has been placed as the viewport to a JScrollPane. I want to place a JPanel on top of the list to act like a header in
a JTable. My problem now is that I place the JPanel at location 0,0 within the JSroll & I set the location of the JList at 0,20. The JList is always placed at 0,0 and the text contained within
the JPanel blend with the first row of the JList.
Can this be done?
Thanks for your time
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are trying to do a header, place the header component and the scrollpane inside another container... If you place the header inside the scrollpane, it will scroll with the rest of the list and just look like the first row of the list...

Something like the following :
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!