Do you know any way of making a JTable resize itself up to a maximum predefined height and then provide scroll bars?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Ok. I found a way. Not the cleanest but it works.
If the size of the JTable is determined by another container (in my case it was a JPanel) the idea is to calculate the panel height based on JTable.getRowCount().
so it was a simple case of setting something like this: