public class BoundsPopupMenuListener extends Object implements 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(BasicComboPopup popup) |
int |
getMaximumWidth()
Return the maximum width of the popup.
|
protected int |
getScrollBarWidth(BasicComboPopup popup,
JScrollPane scrollPane) |
protected JScrollPane |
getScrollPane(BasicComboPopup popup) |
protected boolean |
horizontalScrollBarWillBeVisible(BasicComboPopup popup,
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(PopupMenuEvent e) |
void |
popupMenuWillBecomeInvisible(PopupMenuEvent e) |
void |
popupMenuWillBecomeVisible(PopupMenuEvent e)
Alter the bounds of the popup just before it is made visible.
|
protected void |
popupWider(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(PopupMenuEvent e)
popupMenuWillBecomeVisible
in interface PopupMenuListener
protected void customizePopup(BasicComboPopup popup)
protected void popupWider(BasicComboPopup popup)
protected JScrollPane getScrollPane(BasicComboPopup popup)
protected int getScrollBarWidth(BasicComboPopup popup, JScrollPane scrollPane)
protected boolean horizontalScrollBarWillBeVisible(BasicComboPopup popup, JScrollPane scrollPane)
public void popupMenuCanceled(PopupMenuEvent e)
popupMenuCanceled
in interface PopupMenuListener
public void popupMenuWillBecomeInvisible(PopupMenuEvent e)
popupMenuWillBecomeInvisible
in interface PopupMenuListener
Copyright © 2018. All rights reserved.