public class BoundsPopupMenuListener
This class will change the bounds of the JComboBox popup menu to support different functionality. It will support the following features: - a horizontal scrollbar can be displayed when necessary - the popup can be wider than the combo box - the popup can be displayed above the combo box
Class will only work for a JComboBox that uses a BasicComboPop. Code below is from this page: https://tips4java.wordpress.com/2010/11/28/combo-box-popup/Constructor and description |
---|
BoundsPopupMenuListener
() Convenience constructore to allow the display of a horizontal scrollbar when required. |
BoundsPopupMenuListener
(boolean popupWider, boolean popupAbove) Convenience constructor that allows you to display the popup wider and/or above the combo box. |
BoundsPopupMenuListener
(int maximumWidth) Convenience constructor that allows you to display the popup wider than the combo box and to specify the maximum width |
BoundsPopupMenuListener
(boolean scrollBarRequired, boolean popupWider, int maximumWidth, boolean popupAbove) General purpose constructor to set all popup properties at once. |
Type Params | Return Type | Name and description |
---|---|---|
|
int |
getMaximumWidth() Return the maximum width of the popup. |
|
boolean |
isPopupAbove() Determine if the popup should be displayed above the combo box. |
|
boolean |
isPopupWider() Determine if the popup might be displayed wider than the combo box |
|
boolean |
isScrollBarRequired() Determine if the horizontal scroll bar might be required for the popup |
|
void |
popupMenuCanceled(javax.swing.event.PopupMenuEvent e) |
|
void |
popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent e) |
|
void |
popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent e) Alter the bounds of the popup just before it is made visible. |
|
void |
setMaximumWidth(int maximumWidth) Set the maximum width for the popup. |
|
void |
setPopupAbove(boolean popupAbove) Change the location of the popup relative to the combo box. |
|
void |
setPopupWider(boolean popupWider) Change the width of the popup to be the greater of the width of the combo box or the preferred width of the popup. |
|
void |
setScrollBarRequired(boolean scrollBarRequired) For some reason the default implementation of the popup removes the horizontal scrollBar from the popup scroll pane which can result in the truncation of the rendered items in the popup. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Convenience constructore to allow the display of a horizontal scrollbar when required.
Convenience constructor that allows you to display the popup wider and/or above the combo box.
popupWider
- when true, popup width is based on the popup
preferred widthpopupAbove
- when true, popup is displayed above the comboboxConvenience constructor that allows you to display the popup wider than the combo box and to specify the maximum width
maximumWidth
- the maximum width of the popup. The
popupAbove value is set to "true".General purpose constructor to set all popup properties at once.
scrollBarRequired
- display a horizontal scrollbar when the
preferred width of popup is greater than width of scrollPane.popupWider
- display the popup at its preferred withmaximumWidth
- limit the popup width to the value specified
(minimum size will be the width of the combo box)popupAbove
- display the popup above the combo boxReturn the maximum width of the popup.
Determine if the popup should be displayed above the combo box.
Determine if the popup might be displayed wider than the combo box
Determine if the horizontal scroll bar might be required for the popup
Alter the bounds of the popup just before it is made visible.
Set the maximum width for the popup. This value is only used when setPopupWider( true ) has been specified. A value of -1 indicates that there is no maximum.
maximumWidth
- the maximum width of the popupChange the location of the popup relative to the combo box.
popupAbove
- true display popup above the combo box,
false display popup below the combo box.Change the width of the popup to be the greater of the width of the combo box or the preferred width of the popup. Normally the popup width is always the same size as the combo box width.
popupWider
- true adjust the width as required.For some reason the default implementation of the popup removes the horizontal scrollBar from the popup scroll pane which can result in the truncation of the rendered items in the popup. Adding a scrollBar back to the scrollPane will allow horizontal scrolling if necessary.
scrollBarRequired
- true add horizontal scrollBar to scrollPane
false remove the horizontal scrollBarReadyAPI functional (soapui) SDK 3.20.1