• Post Reply Bookmark Topic Watch Topic
  • New Topic

Scroll pane with JTable

 
prashant gour
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am working on JTable and rows of table is growing on certain event but when number of rows become more than height Vertical Scroll bar is added.
after the adding scroll bar if i resize the panel Table shows weird UI.

i did set following:
ScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
ScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);


if i make follwing change there is no problem not at all.

ScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
ScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);


is there any clue why does that happen? is there something wrong with Scrollpane or anything else.
any body gone through same please share with me.

Prashant
 
trinity jecob
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which layout you have used for your panel?
 
prashant gour
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Gridbag layout and working fine if i remove scroll pane from table.
 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If anybody can answer this question - I would also appreciate knowing. I have lots of problems similar to this with JTables. To avoid them I like sticking with grid layout, Box layout and JSplitPanes... In most cases a combination of these three will give you a functional gui without the hassle of other more sophisticated layouts. I wish I could find a comprehensive tutorial on how to debug swing layouts and guis.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!