AudioDeviceSelectorComponent customization

I have been using the AudioDeviceSelectorComponent in a few projects and I really appreciate what it does. It’s tedious to write by hand, and get it right in all cases.

I would like to note two things that I’ve been missing when I worked with it, to discuss which of these could actually be sensible additions to the class, and which I can solve otherwise.

  1. A method getBestHeight would be nice, to let the parent component know how much space is needed to show everything. Because sometimes you want to place another component below this one, or adjust the parent window’s size to just as much height as is needed. The height varies depending on what the user selects. Sometimes the multi-out selection will be visible, sometimes not. So it’s hard to ensure from outside that enough space is available, without showing a large gap at the bottom.
  2. It would be great to be able to customize how wide the columns are, because you may want to add more PropertyComponents below it, and line up the columns. The layout proportions are currently hardcoded in the resized() method. Right now I’m just copying the numbers over to my code, which isn’t too bad.

Have you tried adding a ComponentListener to the AudioDeviceSelectorComponent before making the parent component visible? You should be receiving resize events from the component and then work out the best height, right?

Sounds like a good idea. Do you think you could send us a patch?