java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
org.autogui.swing.GuiSwingViewImagePane.ImagePaneBase
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
- Direct Known Subclasses:
GuiSwingViewImagePane.PropertyImagePane
- Enclosing class:
GuiSwingViewImagePane
a base image-pane for rendering an image object
- Since:
- 1.7
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
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 TypeFieldDescriptionprotected Image
protected GuiSwingViewImagePane.ImageScale
protected boolean
protected GuiSwingViewImagePane.ImageScaleFit
protected GuiSwingViewImagePane.ImageScaleFit
protected Dimension
protected List
<PopupCategorized.CategorizedMenuItem> protected PopupExtension
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, 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
ConstructorsModifierConstructorDescriptionthe constructor callinginit()
protected
ImagePaneBase
(boolean init) -
Method Summary
Modifier and TypeMethodDescriptionprotected GuiSwingViewImagePane.ImageCopyAction
createScaleInfo
(Dimension size) createSizeInfo
(Dimension size) protected List
<PopupCategorized.CategorizedMenuItem> static void
set viewPosition of viewportgetImage()
getRenderedImage
(Image image) convert image to a writableRenderedImage
protected boolean
void
init()
initializervoid
adding listeners for supporting drag scrollingvoid
make this view fucusable with a mouse-listener of focusingvoid
initialize popup-menuvoid
initializer for image-scalingboolean
boolean
checking for the ALT-down mask; Note: macOS trackpad-scrolling will set a Shift-down mask for some gestures that occurs in normal use.protected boolean
protected void
void
set the image and update renderingvoid
setImageScale
(GuiSwingViewImagePane.ImageScale imageScale) update the imageScale value and relating listeners.void
setImageScaleAutoSwitchByMouseWheel
(boolean imageScaleAutoSwitchByMouseWheel) set the property and add/remove the imageScale if it is aMouseWheelListener
void
callJComponent.setPreferredSize(Dimension)
with imageSizeprotected Dimension
void
reflects image-scale settingsMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, 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, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, updateUI
Methods inherited from class java.awt.Container
add, add, add, add, 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, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
image
-
imageSize
-
imageScale
-
imageScaleDefault
-
imageScaleFit
-
imageScaleMouseWheel
-
imageScaleAutoSwitchByMouseWheel
protected boolean imageScaleAutoSwitchByMouseWheel -
autoSwitchByMouseWheel
-
switchFitAction
-
popup
-
-
Constructor Details
-
Method Details
-
init
public void init()initializer -
initScale
public void initScale()initializer for image-scaling -
initPopup
public void initPopup()initialize popup-menu -
initDragScroll
public void initDragScroll()adding listeners for supporting drag scrolling- Since:
- 1.5
-
dragMove
set viewPosition of viewport- Parameters:
dragStart
- the previous drag-position (the previous value of "current")current
- the next drag-position (can be obtained byMouseEvent.getLocationOnScreen()
)viewport
- the target view-port (the parent of the target-pane)
-
initFocus
public void initFocus()make this view fucusable with a mouse-listener of focusing -
isImageScaleChangeByMouseWheel
checking for the ALT-down mask; Note: macOS trackpad-scrolling will set a Shift-down mask for some gestures that occurs in normal use.- Parameters:
event
- an event- Returns:
- the event is satisfied the condition for updating scale setting; checking ALT down.
- Since:
- 1.7
-
imageScaleMouseWheelShouldBeActivated
- Parameters:
e
- the tested event- Returns:
- returns the autho-switch property value
-
setImageScaleAutoSwitchByMouseWheel
public void setImageScaleAutoSwitchByMouseWheel(boolean imageScaleAutoSwitchByMouseWheel) set the property and add/remove the imageScale if it is aMouseWheelListener
- Parameters:
imageScaleAutoSwitchByMouseWheel
- the new flag
-
isImageScaleAutoSwitchByMouseWheel
public boolean isImageScaleAutoSwitchByMouseWheel()- Returns:
- the auto-switch property value
-
getImage
- Returns:
- the current-image object
-
setImageScale
update the imageScale value and relating listeners.- update
MouseWheelListener
if the imageScale has the interface - if the imageScale is a
GuiSwingViewImagePane.ImageScaleFit
, inherits the current scale - call
updateScale()
- Parameters:
imageScale
- the new instance
- update
-
setImage
set the image and update rendering- Parameters:
image
- the new image
-
setPreferredSizeFromImageSize
public void setPreferredSizeFromImageSize()callJComponent.setPreferredSize(Dimension)
with imageSize -
getImageScale
- Returns:
- the image-scale object
-
getImageScaleDefault
- Returns:
- the image-scale-default object
-
getImageScaleMouseWheel
- Returns:
- the image-scale-wheel object
-
getImageScaleFit
- Returns:
- the image-scale-fit object
-
paintComponent
- Overrides:
paintComponent
in classJComponent
-
getViewSize
- Returns:
- size - insets , or if the parent is a viewport, the parent-size - insets
-
subtract
- Parameters:
dim
- a dimensioninsets
- a insets or null- Returns:
- subtract insets from dim
-
isParentViewport
protected boolean isParentViewport()- Returns:
Component.getParent()
-
getImageScaledSize
- Returns:
- the fit
-
getImageSize
- Returns:
- the imageSize object
-
updateScale
public void updateScale()reflects image-scale settings -
getViewPosition
- Returns:
- the parent viewport's viewPosition or (0,0)
- Since:
- 1.5
-
getRenderedImage
convert image to a writableRenderedImage
- Parameters:
image
- the source image- Returns:
- call
GuiReprValueImagePane.getRenderedImageWithSupport(GuiReprValueImagePane.RenderedImageGetterSupport, Object)
-
getStaticMenuItems
- Returns:
- default list of menu-items; creates the list if not yet
-
createStaticMenuItems
- Returns:
- creating a list of menu-item
-
createCopyAction
-
getDynamicMenuItems
- Returns:
- size-info and scale-info
-
createSizeInfo
- Parameters:
size
- the given image-size- Returns:
- the label of current size-info
-
createScaleInfo
- Parameters:
size
- the given image-size- Returns:
- the label of current scale-info
-