hemanth kumar
hemanth kumar

Reputation: 3078

Vertical scrollbar covering the last column data of jtable(last column data is right aligned)

I am using a jtable which have 8 rows by default. When I add a new row using a button click a vertical scrollbar comes into picture and covers up my data of last column in jtable which is right aligned. How can I overcome this?

Upvotes: 1

Views: 731

Answers (2)

trashgod
trashgod

Reputation: 205785

Specify setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS) on the JScrollPane. This will leave room for the scroll bar when (if) it becomes necessary.

Upvotes: 2

jzd
jzd

Reputation: 23629

Sounds like you need to give your table a little bit more space to account for the addition of a scroll bar. You will need to possibly mess with the preferredSize.

Upvotes: 0

Related Questions