public class BoundsPopupMenuListener
extends java.lang.Object
implements javax.swing.event.PopupMenuListener
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(boolean scrollBarRequired,
boolean popupWider,
int maximumWidth,
boolean popupAbove)
General purpose constructor to set all popup properties at once.
|
BoundsPopupMenuListener(int maximumWidth)
Convenience constructor that allows you to display the popup wider
than the combo box and to specify the maximum width
|
Modifier and Type | Method and Description |
---|---|
protected void |
customizePopup(javax.swing.plaf.basic.BasicComboPopup popup) |
int |
getMaximumWidth()
Return the maximum width of the popup.
|
protected int |
getScrollBarWidth(javax.swing.plaf.basic.BasicComboPopup popup,
javax.swing.JScrollPane scrollPane) |
protected javax.swing.JScrollPane |
getScrollPane(javax.swing.plaf.basic.BasicComboPopup popup) |
protected boolean |
horizontalScrollBarWillBeVisible(javax.swing.plaf.basic.BasicComboPopup popup,
javax.swing.JScrollPane scrollPane) |
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.
|
protected void |
popupWider(javax.swing.plaf.basic.BasicComboPopup popup) |
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 popop.
|
public BoundsPopupMenuListener()
public BoundsPopupMenuListener(boolean popupWider, boolean popupAbove)
popupWider
- when true, popup width is based on the popup preferred
widthpopupAbove
- when true, popup is displayed above the comboboxpublic BoundsPopupMenuListener(int maximumWidth)
maximumWidth
- the maximum width of the popup. The popupAbove value is
set to "true".public BoundsPopupMenuListener(boolean scrollBarRequired, boolean popupWider, int maximumWidth, boolean popupAbove)
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 boxpublic int getMaximumWidth()
public void setMaximumWidth(int maximumWidth)
maximumWidth
- the maximum width of the popuppublic boolean isPopupAbove()
public void setPopupAbove(boolean popupAbove)
popupAbove
- true display popup above the combo box, false display
popup below the combo box.public boolean isPopupWider()
public void setPopupWider(boolean popupWider)
popupWider
- true adjust the width as required.public boolean isScrollBarRequired()
public void setScrollBarRequired(boolean scrollBarRequired)
scrollBarRequired
- true add horizontal scrollBar to scrollPane false remove
the horizontal scrollBarpublic void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent e)
popupMenuWillBecomeVisible
in interface javax.swing.event.PopupMenuListener
protected void customizePopup(javax.swing.plaf.basic.BasicComboPopup popup)
protected void popupWider(javax.swing.plaf.basic.BasicComboPopup popup)
protected javax.swing.JScrollPane getScrollPane(javax.swing.plaf.basic.BasicComboPopup popup)
protected int getScrollBarWidth(javax.swing.plaf.basic.BasicComboPopup popup, javax.swing.JScrollPane scrollPane)
protected boolean horizontalScrollBarWillBeVisible(javax.swing.plaf.basic.BasicComboPopup popup, javax.swing.JScrollPane scrollPane)
public void popupMenuCanceled(javax.swing.event.PopupMenuEvent e)
popupMenuCanceled
in interface javax.swing.event.PopupMenuListener
public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent e)
popupMenuWillBecomeInvisible
in interface javax.swing.event.PopupMenuListener