public class JImage
extends javax.swing.JComponent
implements java.awt.event.MouseMotionListener, java.awt.event.MouseListener, java.awt.event.KeyListener
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected int |
cornerWidth |
protected boolean |
crossCursor |
protected java.awt.Color |
cursorColor |
protected int |
dragCorner |
protected int |
dragMovableMarkerCorner |
protected int |
grid |
static int |
HORIZONTAL_BOTTOM |
static int |
HORIZONTAL_CENTER |
static int |
HORIZONTAL_TOP |
protected int |
horizontalPosition |
protected boolean |
isDragging |
protected boolean |
isDraggingMovable |
protected java.awt.Insets |
margin |
protected static int |
MARKER_CROSS |
protected static int |
MARKER_HLINE |
protected static int |
MARKER_MOVABLE |
protected static int |
MARKER_RECT |
protected static int |
MARKER_VLINE |
protected java.util.Vector<fr.esrf.tangoatk.widget.util.Marker> |
markers |
protected double |
markerScaleFactor |
protected int |
mode |
static int |
MODE_CROSS |
static int |
MODE_LINE |
static int |
MODE_RECT |
protected int |
movableMarkerId |
protected java.awt.Color |
selectionColor |
protected boolean |
selectionEnabled |
protected boolean |
snapToGrid |
protected java.awt.image.BufferedImage |
theImage |
static int |
VERTICAL_CENTER |
static int |
VERTICAL_LEFT |
static int |
VERTICAL_RIGHT |
protected int |
verticalPosition |
protected int |
x1 |
protected int |
x2 |
protected JLAxis |
xAxis |
protected int |
xAxisHeight |
protected int |
xAxisUpMargin |
protected int |
xCursor |
protected int |
xOrg |
protected int |
y1 |
protected int |
y2 |
protected JLAxis |
yAxis |
protected int |
yAxisRightMargin |
protected int |
yAxisWidth |
protected int |
yCursor |
protected int |
yOrg |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
JImage()
Construction
|
Modifier and Type | Method and Description |
---|---|
int |
addCrossMarker(int x,
int y,
java.awt.Color c)
Adds a cross marker at the specified pos
|
int |
addHorizontalLineMarker(int y,
java.awt.Color c)
Adds a horizontal line marker
|
void |
addMarkerListener(MarkerListener l) |
int |
addMovableMarker(int x,
int y,
int width,
int height,
java.awt.Color c,
int lineWidth) |
int |
addRectangleMarker(int x,
int y,
int width,
int height,
java.awt.Color c)
Adds a rectangle marker
|
int |
addRectangleMarker(int x,
int y,
int width,
int height,
java.awt.Color c,
int lineWidth)
Adds a rectangle marker
|
int |
addVerticalLineMarker(int x,
java.awt.Color c)
Adds a vertical line marker
|
protected void |
alignSelection() |
protected java.awt.Rectangle |
buildSelectionRect() |
void |
clearMarkers()
Clears all markers
|
void |
clearSelection()
Clears the current selection.
|
protected void |
clipSelection() |
protected boolean |
cornerMatch(int x,
int y,
int xc,
int yc) |
protected int |
findCorner(int x,
int y) |
protected int |
findMovableCorner(int x,
int y) |
void |
fireMarkerMoved(int markerId,
fr.esrf.tangoatk.widget.util.Marker m) |
void |
fireMarkerSelection(int markerId) |
int |
getHorizontalPosition()
Returns the horizontal selection arrow position (MODE_CROSS selection)
|
java.awt.image.BufferedImage |
getImage()
Returns a handle to the image displayed
|
java.awt.Dimension |
getImageSize()
Returns size of the image (does not include margin)
|
java.awt.Insets |
getMargin()
Returns margin of the image
|
int |
getMarkerNumber() |
java.awt.Dimension |
getMinimumSize() |
java.awt.Dimension |
getPreferredSize() |
java.awt.Color |
getSelectionColor()
Returns the color of the selection area.
|
java.awt.Point[] |
getSelectionCrossPoint()
Returns the current lines selected (MODE_CROSS).
|
int |
getSelectionMode()
Returns the selection mode
|
java.awt.Point[] |
getSelectionPoint()
Returns the current line/rectangle selected.
|
java.awt.Rectangle |
getSelectionRect()
Returns the current rectangle selected.
|
int |
getSnapGrid()
Returns the grid spacing (Pixel)
|
int |
getVerticalPosition()
Returns the vertical selection arrow position (MODE_CROSS selection)
|
JLAxis |
getXAxis()
Returns a handle of the X axis.
|
int |
getXOrigin()
Return origin of the image within the component
|
JLAxis |
getYAxis()
Returns a handle of the Y axis.
|
int |
getYOrigin()
Return origin of the image within the component
|
boolean |
hasSelection()
Returns true if a selection exists
|
boolean |
isCrossCursor()
Returns true if cross curosr is enabled.
|
boolean |
isSelectionEnabled()
Returns true only if the selection is enabled.
|
boolean |
isSnapToGrid()
Return true when snap to grid mode is enable
|
void |
keyPressed(java.awt.event.KeyEvent e) |
void |
keyReleased(java.awt.event.KeyEvent e) |
void |
keyTyped(java.awt.event.KeyEvent e) |
static void |
main(java.lang.String[] args) |
protected void |
measureAxis() |
void |
mouseClicked(java.awt.event.MouseEvent e) |
void |
mouseDragged(java.awt.event.MouseEvent e) |
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
mouseReleased(java.awt.event.MouseEvent e) |
void |
paint(java.awt.Graphics g) |
protected void |
paintAxis(java.awt.Graphics g) |
protected void |
paintCursor(java.awt.Graphics g) |
protected void |
paintSelection(java.awt.Graphics g) |
void |
removeMarkerListener(MarkerListener l)
Remove the specified ROI Listener
|
protected void |
repaintBoundingRect(java.awt.Rectangle oldSel) |
void |
setCrossCursor(boolean enable)
Enable or disable the cross cursor.
|
void |
setCursorColor(java.awt.Color c)
Set the cross cursor color.
|
void |
setHorizontalPosition(int horizontalPosition)
Sets the horizontal selection arrow position (MODE_CROSS selection)
|
void |
setImage(java.awt.image.BufferedImage i)
Sets the image to be displayed
|
void |
setMargin(java.awt.Insets i)
Sets the margin of the JImage
|
void |
setMarkerPos(int id,
int x,
int y,
int nWidth,
int nHeight)
Sets the position of a marker
|
void |
setMarkerScale(double s)
Sets the scale factor for markers
|
void |
setSelection(int _x1,
int _y1,
int _x2,
int _y2)
Sets the current selection.
|
void |
setSelectionColor(java.awt.Color selectionColor)
Sets the color of the selection area
|
void |
setSelectionEnabled(boolean b)
Enable or disable the selection.
|
void |
setSelectionMode(int m)
Sets the selection mode
|
void |
setSnapGrid(int b)
Sets the grid spacing (Pixel)
|
void |
setSnapToGrid(boolean b)
Enables the grid mode.
|
void |
setVerticalPosition(int verticalPosition)
Sets the vertical selection arrow position (MODE_CROSS selection)
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, 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
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
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, 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 static final int MODE_LINE
public static final int MODE_RECT
public static final int MODE_CROSS
public static final int VERTICAL_LEFT
public static final int VERTICAL_CENTER
public static final int VERTICAL_RIGHT
public static final int HORIZONTAL_TOP
public static final int HORIZONTAL_CENTER
public static final int HORIZONTAL_BOTTOM
protected static final int MARKER_CROSS
protected static final int MARKER_RECT
protected static final int MARKER_VLINE
protected static final int MARKER_HLINE
protected static final int MARKER_MOVABLE
protected java.awt.image.BufferedImage theImage
protected java.awt.Insets margin
protected int xOrg
protected int yOrg
protected boolean selectionEnabled
protected int mode
protected boolean isDragging
protected boolean isDraggingMovable
protected int dragCorner
protected int cornerWidth
protected int dragMovableMarkerCorner
protected int movableMarkerId
protected int x1
protected int y1
protected int x2
protected int y2
protected boolean snapToGrid
protected int grid
protected java.util.Vector<fr.esrf.tangoatk.widget.util.Marker> markers
protected double markerScaleFactor
protected JLAxis xAxis
protected int xAxisHeight
protected int xAxisUpMargin
protected JLAxis yAxis
protected int yAxisWidth
protected int yAxisRightMargin
protected boolean crossCursor
protected java.awt.Color cursorColor
protected int xCursor
protected int yCursor
protected java.awt.Color selectionColor
protected int horizontalPosition
protected int verticalPosition
public void setCrossCursor(boolean enable)
enable
- True to enable cross cursor, false otherwise.public void setCursorColor(java.awt.Color c)
c
- Cursor colorsetCrossCursor(boolean)
public boolean isCrossCursor()
public void setSelectionEnabled(boolean b)
b
- Selection modeisSelectionEnabled()
public boolean isSelectionEnabled()
public java.awt.Rectangle getSelectionRect()
public java.awt.Point[] getSelectionPoint()
public java.awt.Point[] getSelectionCrossPoint()
public void setSelectionMode(int m)
m
- 0 for Line selection , 1 for Rectangle selectionpublic int getSelectionMode()
public boolean hasSelection()
public void setSelection(int _x1, int _y1, int _x2, int _y2)
_x1
- Top left corner x coordinate_y1
- Top left corner y coordinate_x2
- Bottom right corner x coordinate_y2
- Bottom right corner y coordinatepublic void clearSelection()
public void setMargin(java.awt.Insets i)
i
- Image marginpublic java.awt.Insets getMargin()
public int getXOrigin()
public int getYOrigin()
public void setImage(java.awt.image.BufferedImage i)
i
- Imagepublic JLAxis getXAxis()
public JLAxis getYAxis()
public java.awt.image.BufferedImage getImage()
public java.awt.Dimension getImageSize()
public boolean isSnapToGrid()
setSnapToGrid(boolean)
public void setSnapToGrid(boolean b)
b
- isSnapToGrid()
,
getSnapGrid()
public int getSnapGrid()
public void setSnapGrid(int b)
b
- Grid width in pixelspublic int addCrossMarker(int x, int y, java.awt.Color c)
x
- X coordinatesy
- Y coordinatesc
- Marker Colorpublic int addMovableMarker(int x, int y, int width, int height, java.awt.Color c, int lineWidth)
public int addRectangleMarker(int x, int y, int width, int height, java.awt.Color c, int lineWidth)
x
- X topleft corner coordinatey
- Y topleft corner coordinatewidth
- Rectangle widthheight
- Rectangle hieghtc
- Marker ColorlineWidth
- lineWidthpublic int addRectangleMarker(int x, int y, int width, int height, java.awt.Color c)
x
- X topleft corner coordinatey
- Y topleft corner coordinatewidth
- Rectangle widthheight
- Rectangle hieghtc
- Marker Colorpublic int addVerticalLineMarker(int x, java.awt.Color c)
x
- Horizontal positionc
- Marker colorpublic int addHorizontalLineMarker(int y, java.awt.Color c)
y
- Vertical positionc
- Marker colorpublic void setMarkerPos(int id, int x, int y, int nWidth, int nHeight)
id
- Marker indexx
- X coordinate (ignored when HORIZONTAL_LINE Marker)y
- Y coordinate (ignored when VERTICAL_LINE Marker)nWidth
- Rectangle width (ignored when CROSS Marker, LINE Marker)nHeight
- Rectangle height (ignored when CROSS Marker, LINE Marker)public void clearMarkers()
public int getMarkerNumber()
public void setMarkerScale(double s)
s
- Scale factorpublic int getHorizontalPosition()
public void setHorizontalPosition(int horizontalPosition)
horizontalPosition
- Horizontal positionpublic int getVerticalPosition()
public void setVerticalPosition(int verticalPosition)
verticalPosition
- Vertical positionpublic java.awt.Color getSelectionColor()
public void setSelectionColor(java.awt.Color selectionColor)
selectionColor
- Selection colorpublic void addMarkerListener(MarkerListener l)
public void removeMarkerListener(MarkerListener l)
l
- ROI listenerprotected void paintCursor(java.awt.Graphics g)
protected void paintSelection(java.awt.Graphics g)
protected void measureAxis()
protected void paintAxis(java.awt.Graphics g)
public void paint(java.awt.Graphics g)
paint
in class javax.swing.JComponent
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
protected boolean cornerMatch(int x, int y, int xc, int yc)
protected int findCorner(int x, int y)
protected int findMovableCorner(int x, int y)
protected java.awt.Rectangle buildSelectionRect()
protected void repaintBoundingRect(java.awt.Rectangle oldSel)
protected void clipSelection()
public void fireMarkerSelection(int markerId)
public void fireMarkerMoved(int markerId, fr.esrf.tangoatk.widget.util.Marker m)
protected void alignSelection()
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
public static void main(java.lang.String[] args)