Closed bobjacobsen closed 1 year ago
I don't see any code to resize the combo box when there are nodes. The only code seems to be active when node count == 0. So how does this work?
A JComboBox by default has a preferred size that will hold its longest content. That's used by a pack() call during layout, so it'll be that size unless there are external constraints.
The previous code was overriding that behavior by always by setting a manual size. I removed that to allow the default behavior to work, setting it specifically only when there isn't any content. That's needed because the default-no-content size is 20 characters, smaller than our typical identifiers.
This changes the handling of the JComboBox in org.openlcb.swing.NodeSelector so that it automatically sizes itself to the largest selection string available when the NodeSelector is created.
If there are no known nodes, a default of 70 spaces wide it used
The JComboBox does not resize if additional nodes are discovered after it's been created to prevent the GUI from moving around spontaneously.