I have a JList that displays the list horizontally, in one row. The JList's items are dynamically added. When there are too many items on the list. some items are cut off and not displayed. My JFrame is not resizable and that is because I have a panel with custom painting. My co-workers say that it is generally a bad idea to make JFrame not resizable. Some say I should pre-calculate sizes. Here is a simple layout of my program:
+---------------------------------------------------+
| |
| |
| Custom Painting JPanel |
| |
| |
|---------------------------------------------------|
| |
| Dynamic JList: |
| +--------+ +--------+ +--------+ |
| | Item 1 | | Item 2 | | Item 3 | |
| +--------+ +--------+ +--------+ |
| |
+---------------------------------------------------+
When too much items are added, this happens:
+---------------------------------------------------+
| |
| |
| Custom Painting JPanel |
| |
| |
|---------------------------------------------------|
| |
| Dynamic JList: |
| +--------+ +--------+ +--------+ +-------|
| | Item 1 | | Item 2 | | Item 3 | | Item 4|
| +--------+ +--------+ +--------+ +-------|
| |
+---------------------------------------------------+
The whole application (JFrame) should preferably not be resized, and also preferable fill the whole width of the application. If not resizing cannot be done, I can make do with other solutions.
EDIT: The items in this case are actually buttons
EDIT: I do have an idea. I forgot to mention that the items shown are from a an array of buttons. I have another component that controls which buttons are shown. So basically, all I have to do is add all the buttons, then sort of "hide" some, depending on the control