0
votes

I'm trying to make a ToDoManager in java. For now I have about what I want it to be for a basic version. But I'm having a problem with the size of a panel.

I have a main JFrame. This contains a JPanel, say jPanel1. jPanel1 has 2 buttons (add and remove) and another JPanel (say jPanel2).

jPanel2 contains a JScrollPane, which contains a modified version of JTable.

The thing I want is to tell the JTable to stretch out, so i can view everything in the JTable, and then tell the JScrollPane and jPanel2 to "Pack", or resize, so the JTable is completely vissable (if not possible the JScrollPane should do its work and draw the scrollbars).

This is what I have got at the moment:

GUI swing So maybe you can see 2 problems:

1) The horizontal scroll bar does not appear. (But I did set the scroll bar: HORIZONTAL_AS_NEEDED)

2) I did not set any preferred size for the main JFrame, nor for the jPanel1, but it packs always as the same size. So I would like to stretch the jPanel2 to the full JTable, and if that would exceed the screen size, draw the scroll bars.

1
Post an SSCCE of what you already got. - Bnrdo
Thanks forchecking this out, but in the meantime i solved the issue by using another layout manager for the JPanel2. Thank you for your time though. Ps: How can i close this thread? - kdlannoy

1 Answers

0
votes

Using another layout manager, it's a lot easier to comprehend the usage of the JPanels and this concludes the problem.