public class CustomPopup extends Popup implements WindowFocusListener, ComponentListener
Modifier and Type | Class and Description |
---|---|
static interface |
CustomPopup.CustomPopupCloseListener
CustomPopupCloseListener, Any class that uses a CustomPopup (or any other class), may
implement this interface to be notified when the CustomPopup is closed.
|
Constructor and Description |
---|
CustomPopup(Component contentsComponent,
Window topWindow,
CustomPopup.CustomPopupCloseListener optionalCustomPopupCloseListener,
Border optionalBorder)
Constructor, This creates and initializes instances of this class.
|
Modifier and Type | Method and Description |
---|---|
void |
componentHidden(ComponentEvent e)
componentHidden, Part of ComponentListener.
|
void |
componentMoved(ComponentEvent e)
componentMoved, Part of ComponentListener.
|
void |
componentResized(ComponentEvent e)
componentResized, Part of ComponentListener.
|
void |
componentShown(ComponentEvent e)
componentShown, Part of ComponentListener.
|
Rectangle |
getBounds()
getBounds, This returns the bounds of the CustomPopup displayWindow in the form of a
Rectangle object.
|
void |
hide()
hide, This hides the popup window.
|
void |
setLocation(int popupX,
int popupY)
setLocation, This changes the location of the popup window.
|
void |
setMinimumSize(Dimension minimumSize) |
void |
show()
show, This shows the visible component of the popup window.
|
void |
windowGainedFocus(WindowEvent e)
windowGainedFocus, Part of WindowFocusListener.
|
void |
windowLostFocus(WindowEvent e)
windowLostFocus, Part of WindowFocusListener.
|
public CustomPopup(Component contentsComponent, Window topWindow, CustomPopup.CustomPopupCloseListener optionalCustomPopupCloseListener, Border optionalBorder)
contentsComponent
- This is the component that you wish to display inside this popup.topWindow
- When the window that surrounds a popup is moved, the popup will be
automatically closed. The topWindow is the window that should be watched for movement. The
window that is needed is usually the top window of the component hierarchy, of the component
that initiated the popup. The function SwingUtilities.getWindowAncestor() can be useful for
getting the topWindow.optionalCustomPopupCloseListener
- If this is supplied, it will be notified when the
hide() function is called on this popup. This will occur regardless of whether the hide()
function was called internally or externally.optionalBorder
- If this is supplied, it will be used as the border for the popup
window. If no border is supplied, then a default border will be used.public void componentHidden(ComponentEvent e)
componentHidden
in interface ComponentListener
public void componentMoved(ComponentEvent e)
componentMoved
in interface ComponentListener
public void componentResized(ComponentEvent e)
componentResized
in interface ComponentListener
public void componentShown(ComponentEvent e)
componentShown
in interface ComponentListener
public Rectangle getBounds()
public void hide()
public void setLocation(int popupX, int popupY)
public void show()
public void windowGainedFocus(WindowEvent e)
windowGainedFocus
in interface WindowFocusListener
public void windowLostFocus(WindowEvent e)
windowLostFocus
in interface WindowFocusListener
public void setMinimumSize(Dimension minimumSize)
Copyright © 2021. All rights reserved.