|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
net.grelf.grip.ImPane
public class ImPane
This class is the component placed on an ImFrame's content pane to display an image. It has an object of class Im which has the image itself. ImPane also has a scaled-down version of the image for displaying at the user's required scale. Code for managing the scaling is held here. This class also looks after user interaction with the image via a mouse, mainly for drawing and measuring.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected static java.lang.String[] |
zoomPercents
Strings for use in ImFrame caption bars to show the current zoom percentage. |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, 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 |
|---|
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 | |
|---|---|
ImPane(ImFrame parent,
int width,
int height,
GlassPane gp)
|
|
ImPane(ImFrame parent,
java.lang.String imFilename,
GlassPane gp)
|
|
ImPane(ImFrame parent,
java.lang.String imFilename,
int width,
int height,
GlassPane gp)
|
|
| Method Summary | |
|---|---|
void |
clearAssociatedPane()
Set associated pane to null. |
void |
dispose()
Tidy up, for when the parent ImFrame is closed. |
GlassPane |
getGlassPane()
Get a reference to the GlassPane object which overlays this ImPane in the parent ImFrame. |
Im |
getIm()
Get a reference to the Im object for this ImPane, from which we can get to the image itself. |
ImFrame |
getImFrame()
Get a reference to the parent ImFrame in which this ImPane is displayed. |
int |
getIpHeight()
Get the height of this ImPane, in pixels. |
int |
getIpWidth()
Get the width of this ImPane, in pixels. |
java.awt.Point |
getOrigin()
Get the origin of the viewport of the scroll pane of the parent ImFrame. |
java.awt.Dimension |
getPreferredScrollableViewportSize()
Implementing javax.swing.Scrollable. |
int |
getScale()
Get the current scale factor for display. |
Im |
getScaledIm()
Get reference to the scaled version of the Im, which is currently displayed in the parent ImFrame. |
int |
getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Implementing javax.swing.Scrollable. |
boolean |
getScrollableTracksViewportHeight()
Implementing javax.swing.Scrollable. |
boolean |
getScrollableTracksViewportWidth()
Implementing javax.swing.Scrollable. |
int |
getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Implementing javax.swing.Scrollable. |
boolean |
isPseudocolour()
Whether the image is currently displayed in pseudocolour. |
void |
mouseClicked(java.awt.event.MouseEvent e)
Implementing java.awt.event.MouseListener. |
void |
mouseDragged(java.awt.event.MouseEvent e)
Implementing java.awt.event.MouseMotionListener. |
void |
mouseEntered(java.awt.event.MouseEvent e)
Implementing java.awt.event.MouseListener. |
void |
mouseExited(java.awt.event.MouseEvent e)
Implementing java.awt.event.MouseListener. |
void |
mouseMoved(java.awt.event.MouseEvent e)
Implementing java.awt.event.MouseMotionListener. |
void |
mousePressed(java.awt.event.MouseEvent e)
Implementing java.awt.event.MouseListener. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Implementing java.awt.event.MouseListener. |
void |
paintComponent(java.awt.Graphics g)
Draw the image in this ImPane. |
void |
reScale()
Recreate the scaled down version of the Im and reset the caption for the parent ImFrame. |
void |
setAssociatedPane(AssociatedPane ap)
Set an associated pane which will be affected and given data when mouse actions occur in the current pane. |
protected void |
setIm(Im anIm)
Set the Im object for this ImPane. |
void |
setInitialScale()
Sets the scale so that the image would fit into the screen. |
void |
setIpHeight(int ht)
Sets the height in pixels and then sets preferred size and revalidates, which may involve repainting. |
void |
setIpSize(int wd,
int ht)
Single operation combining setIpWidth and setIpHeight avoids repainting twice. |
void |
setIpWidth(int wd)
Sets the width in pixels and then sets preferred size and revalidates, which may involve repainting. |
protected void |
setPseudocolour(Pseudocolour ps)
|
void |
zoomDown()
Increase the scale factor by 1 (if less than maximum), rescale and redisplay the image. |
void |
zoomUp()
Decrease the scale factor by 1 (if greater than minimum), rescale and redisplay the image. |
| Methods inherited from class javax.swing.JComponent |
|---|
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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, transferFocusBackward, 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, 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, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static java.lang.String[] zoomPercents
| Constructor Detail |
|---|
public ImPane(ImFrame parent,
int width,
int height,
GlassPane gp)
public ImPane(ImFrame parent,
java.lang.String imFilename,
GlassPane gp)
public ImPane(ImFrame parent,
java.lang.String imFilename,
int width,
int height,
GlassPane gp)
| Method Detail |
|---|
public int getScale()
public void setInitialScale()
public Im getIm()
protected void setIm(Im anIm)
public Im getScaledIm()
public java.awt.Point getOrigin()
public int getIpWidth()
public void setIpWidth(int wd)
public int getIpHeight()
public void setIpHeight(int ht)
public void setIpSize(int wd,
int ht)
public ImFrame getImFrame()
public GlassPane getGlassPane()
public boolean isPseudocolour()
protected void setPseudocolour(Pseudocolour ps)
public void clearAssociatedPane()
public void setAssociatedPane(AssociatedPane ap)
public void dispose()
public void reScale()
public void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentpublic void zoomUp()
public void zoomDown()
public java.awt.Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize in interface javax.swing.Scrollable
public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
getScrollableUnitIncrement in interface javax.swing.Scrollable
public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
getScrollableBlockIncrement in interface javax.swing.Scrollablepublic boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth in interface javax.swing.Scrollablepublic boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight in interface javax.swing.Scrollablepublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||