Package edu.wisc.ssec.mcidasv.ui
Class ComponentPopup
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
javax.swing.JWindow
edu.wisc.ssec.mcidasv.ui.ComponentPopup
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,RootPaneContainer
A popup window that attaches itself to a parent and can display an
component without preventing user interaction like a
JComboBox
.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JWindow
JWindow.AccessibleJWindow
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.Type
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
Number of pixels to use to compensate for when the mouse is moved slowly thereby hiding this popup when between components.private static final org.slf4j.Logger
private final MouseAdapter
Determines if the mouse is on me.private Component
private final ComponentAdapter
What to do if the parent compoentn state changes.private final MouseAdapter
Determines if the mouse is on my dad.private static final long
Fields inherited from class javax.swing.JWindow
accessibleContext, rootPane, rootPaneCheckingEnabled
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorsConstructorDescriptionComponentPopup
(Component parent) Create an instance associated with the given parent. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Overridden to make sure our hide listeners are added to child components.boolean
containsPoint
(Component comp, Point point) Does the component contain the screen relative point.boolean
containsPoint
(Component comp, Point point, int fluff) Does the component contain the screen relative point.private static void
Test method.protected boolean
Do we fit between the top of the parent and the top edge of the screen.protected boolean
Do we fit between the bottom of the parent and the edge of the screen.protected static Dimension
Get the calculated total screen size.static void
Test method.void
Set our parent.void
Show this popup above the parent.void
Show this popup below the parent.void
Show this popup deciding whether to show it above or below the parent component.void
showPopupAt
(int x, int y) Show at the specified X and Y.Methods inherited from class javax.swing.JWindow
createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update, windowInit
Methods inherited from class java.awt.Window
addNotify, addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBackground, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setOpacity, setShape, setSize, setSize, setType, setVisible, show, toBack, toFront
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
logger
-
serialVersionUID
- See Also:
-
FLUFF
Number of pixels to use to compensate for when the mouse is moved slowly thereby hiding this popup when between components.- See Also:
-
ourHideAdapter
Determines if the mouse is on me. -
parentsHideAdapter
Determines if the mouse is on my dad. -
parentsCompAdapter
What to do if the parent compoentn state changes. -
parent
-
-
Constructor Details
-
ComponentPopup
Create an instance associated with the given parent.- Parameters:
parent
- The component to attach this instance to.
-
-
Method Details
-
getScreenSize
Get the calculated total screen size.- Returns:
- The dimensions of the screen on the default screen device.
-
containsPoint
Does the component contain the screen relative point.- Parameters:
comp
- The component to check.point
- Screen relative point.fluff
- Size in pixels of the area added to both sides of the component in the x and y directions and used for the contains calculation.- Returns:
- True if the the point lies in the area plus or minus the fluff factor in either direction.
-
containsPoint
Does the component contain the screen relative point.- Parameters:
comp
- The component to check.point
- Screen relative point.- Returns:
- True if the the point lies in the same area occupied by the component.
-
setParent
Set our parent. If there is currently a parent remove the associated listeners and add them to the new parent.- Parameters:
comp
-
-
showAbove
Show this popup above the parent. It is not checked if the component will fit on the screen. -
showBelow
Show this popup below the parent. It is not checked if the component will fit on the screen. -
fitsAbove
Do we fit between the top of the parent and the top edge of the screen.- Returns:
- True if we fit between the upper edge of our parent and the top edge of the screen.
-
fitsBelow
Do we fit between the bottom of the parent and the edge of the screen.- Returns:
- True if we fit between the bottom edge of our parent and the bottom edge of the screen.
-
showPopupAt
Show at the specified X and Y.- Parameters:
x
-y
-
-
showPopup
Show this popup deciding whether to show it above or below the parent component. -
addImpl
Overridden to make sure our hide listeners are added to child components. -
createAndShowGui
Test method. -
main
Test method.- Parameters:
args
-
-