I've got a requirement stating that I should only display tooltips for my combo box values when the item text is longer than the width of the combo box. This seems reasonable, but JList.getWidth() appears to include the scrollbar width. As such, if I hover over a combo box value that goes beyond the left side of the scrollbar, but not beyond the right side of the scrollbar, no tool tips
Does anyone know how I can accurately calculate the width of the scrollbar alone? I've been digging through Swing's APIs, but have not had much luck.
Thanks for any help you can provide!
posted 11 years ago
Aha! Here's the answer:
int scrollBarSize = ((Integer)UIManager.get("ScrollBar.width")).intValue();