public class Stencil extends JPanel
The underlaying application is only accessible through
the holes in the Stencil made with
addHoleFor(JComponent)
Call-outs (notes with the feedback) are placed on the stencil with
add(Component)
When making holes or adding covers in the stencil, a layer name can be specified. Otherwise those operations are done in the default layer.
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
Stencil(JFrame window)
Constructs a new stencil overlaid on the given window.
|
Stencil(JFrame window,
boolean defaultCovered)
Constructs a new stencil overlaid on the given window.
|
Modifier and Type | Method and Description |
---|---|
Component |
add(Component component)
Add a
CallOut component to the stencil. |
Component |
add(Component component,
int index)
This is the same as
add(Component) |
void |
add(Component component,
Object constraints)
This is the same as
add(Component) |
Component |
add(String name,
Component component)
This is the same as
add(Component) |
void |
addCoverFor(JComponent target)
Add a cover for the given target.
|
void |
addCoverFor(JComponent target,
String layerName)
Add a cover for the given target in the named layer.
|
void |
addHoleFor(JComponent target)
Punch a hole in the stencil for the given GUI component.
|
void |
addHoleFor(JComponent target,
String layerName)
Punch a hole in the stencil for the given GUI component in the named layer.
|
boolean |
contains(int x,
int y) |
void |
detach()
Detach the stencil from its window, restoring the window's original
glass pane, focus traversal policy, etc.
|
static Rectangle |
getBoundsAbsolute(Container container,
JComponent component)
Compute the bounds of a component with respect to a container.
|
boolean |
isOptimizedDrawingEnabled() |
void |
paintComponent(Graphics g) |
void |
removeAll()
Remove all call-outs from the stencil.
|
void |
reset()
Remove all holes and covers from the stencil.
|
void |
reset(String layerName)
Remove all holes and covers from the stencil in the named layer.
|
void |
setColour(int red,
int green,
int blue)
Set the colour for the stencil overlay.
|
void |
setColour(Paint paint)
Set the paint for the stencil overlay.
|
void |
setOpacity(int opacity)
Set the opacity of the stencil overlay.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public Stencil(JFrame window)
window
- the frame whose glass pane will be replaced by the stencil.
The original glass pane is restored when calling detach()
public Stencil(JFrame window, boolean defaultCovered)
addCoverFor(JComponent)
is called will be covered.window
- the frame whose glass pane will be replaced by the stencil.defaultCovered
- whether the stencil will cover the whole window by default or notpublic void setColour(int red, int green, int blue)
red
- from 0 to 255green
- from 0 to 255blue
- from 0 to 255public void setColour(Paint paint)
setOpacity(int)
does not have any effect in this case
unless paint
is an instance of Color
.paint
- generic paint object that can be a colour, a gradient, etc.Color
,
SystemColor
,
LinearGradientPaint
,
MultipleGradientPaint
,
RadialGradientPaint
,
TexturePaint
public void setOpacity(int opacity)
setColour(Paint)
and the given paint is not
an instance of Color
.opacity
- from 0 (fully transparent) to 255 (fully opaque)public void detach()
public void addHoleFor(JComponent target)
target
- component that will be accesible through the holepublic void addHoleFor(JComponent target, String layerName)
target
- component that will be accesible through the holelayerName
- name of the stencil layerpublic void addCoverFor(JComponent target)
target
- component to be covered by the stencilpublic void addCoverFor(JComponent target, String layerName)
target
- component to be covered by the stencillayerName
- name of the stencil layerpublic void removeAll()
public void reset()
public void reset(String layerName)
public Component add(String name, Component component)
add(Component)
public Component add(Component component, int index)
add(Component)
public void add(Component component, Object constraints)
add(Component)
public static Rectangle getBoundsAbsolute(Container container, JComponent component)
container
- the reference containercomponent
- the element whose bounds we want to computepublic void paintComponent(Graphics g)
paintComponent
in class JComponent
public boolean contains(int x, int y)
contains
in class JComponent
public boolean isOptimizedDrawingEnabled()
isOptimizedDrawingEnabled
in class JComponent