Package com.xinapse.image
Class ImageSelectionGroupPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.xinapse.image.ImageSelectionGroupPanel
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible
An
ImageSelectionGroupPanel allows the selection of a group of
ReadableImages and contains the mechanism for adding images to the group,
removing images from the group, etc. Usually used to select a set of input images for processing.
For an example of the use of a ImageSelectionGroupPanel, see the Image Algebra Tool in
Jim.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAn interface implemented by classes that want to be able to generate user components to put into anImageSelectionGroupPanel.Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MessageShowerThe parentMessageShowerin which thisImageSelectionGroupPanelis embedded.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_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new ImageSelectionGroupPanel, that is contained within a parent JFrame, and with initially one image in the set of images, and a minimum of one image in the set.ImageSelectionGroupPanel(MessageShower parent, int minNImages, ImageSelectionGroupPanel.ComponentGenerator componentGenerator, double weight) Creates a new ImageSelectionGroupPanel, that is contained within a parent JFrame, and with minimum number and initial number of images in the set given by the argument. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd()Adds another ImageSelectionGroupMemberPanel to this group.voidaddFileChangeCommitListener(ChangeListener listener) Adds a listener that listens for the file name change being committed.voidaddFileTextEditListener(ChangeListener listener) Adds a listener that listens for the file text being edited.voidClear all images from thisImageSelectionGroupPanel.Class<? extends ReadableImage>Returns the class of image that will be filtered when the user first chooses a new image to set in the panel.intReturns the number of ImageSelectionGroupMemberPanels in this group.getReadableImage(int index) Returns the ReadableImage for the ImageSelectionGroupMemberPanel at particular location in the group.getUserComponent(int i) Returns the user component associated with the image selection panel at the given index.Returns all user components.Returns the "current working directory" for this ImageSelectionGroupPanel.voidremoveFileChangeCommitListener(ChangeListener listener) Removes a listener that listens for the file name change being committed.voidremoveFileTextEditListener(ChangeListener listener) removed a listener that listens for the file text being edited.voidsetImageFilterClass(Class<? extends ReadableImage> c) Sets the class of image that will be filtered when the user first chooses a new image to set in the panel.voidsetMaxNImages(int max) Sets the maximum number of images that can be loaded.voidsetNImages(int nImages) Sets the number of ImageSelectionGroupMemberPanels in this group.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, 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, updateMethods 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, validateTreeMethods 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, 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
-
parent
The parentMessageShowerin which thisImageSelectionGroupPanelis embedded.
-
-
Constructor Details
-
ImageSelectionGroupPanel
Creates a new ImageSelectionGroupPanel, that is contained within a parent JFrame, and with initially one image in the set of images, and a minimum of one image in the set.- Parameters:
parent- the parent MessageShower that contains this ImageSelectionGroupPanel. If parent is non-null, it will have its cursor set appropriately when the ImageSelectionGroupPanel is busy.
-
ImageSelectionGroupPanel
public ImageSelectionGroupPanel(MessageShower parent, int minNImages, ImageSelectionGroupPanel.ComponentGenerator componentGenerator, double weight) Creates a new ImageSelectionGroupPanel, that is contained within a parent JFrame, and with minimum number and initial number of images in the set given by the argument.- Parameters:
parent- the parent MessageShower that contains this ImageSelectionGroupPanel. If parent is non-null, it will have its cursor set appropriately when the ImageSelectionGroupPanel is busy.minNImages- the minimum number of images in the set of images in the group.componentGenerator- if non-null, the ComponentGenerator that can generate the user for each image panel.weight- the weight for the GridBagConstraints that will be applied when panels are added.
-
-
Method Details
-
getUserComponent
Returns the user component associated with the image selection panel at the given index.- Parameters:
i- the index.- Returns:
- the user component at index i.
-
getUserComponents
Returns all user components.- Returns:
- an array of all user components.
-
addFileChangeCommitListener
Adds a listener that listens for the file name change being committed.- Parameters:
listener- the listener to add.
-
removeFileChangeCommitListener
Removes a listener that listens for the file name change being committed.- Parameters:
listener- the listener to remove.
-
addFileTextEditListener
Adds a listener that listens for the file text being edited.- Parameters:
listener- the listener to add.
-
removeFileTextEditListener
removed a listener that listens for the file text being edited.- Parameters:
listener- the listener to remove.
-
add
public void add()Adds another ImageSelectionGroupMemberPanel to this group. -
setMaxNImages
public void setMaxNImages(int max) Sets the maximum number of images that can be loaded. By default, the maximum is 4096 (at the time of writing).- Parameters:
max- the maximum number of images that can be loaded.
-
getNImages
public int getNImages()Returns the number of ImageSelectionGroupMemberPanels in this group.- Returns:
- the number of ImageSelectionGroupMemberPanels in this group.
-
getReadableImage
public ReadableImage getReadableImage(int index) throws IndexOutOfBoundsException, UnsetImageException, InvalidImageException Returns the ReadableImage for the ImageSelectionGroupMemberPanel at particular location in the group.- Parameters:
index- the position in the group (indexed from zero).- Returns:
- the java.io.File set for the ImageSelectionGroupMemberPanel at the given position.
- Throws:
IndexOutOfBoundsException- if the index is less than zero or greater than or equal to the number of panels in the group.UnsetImageException- if no image has been set in the ImageSelectionGroupMemberPanel at the given position.InvalidImageException- if the image at the requsted position is invalid.
-
clearAllImages
public void clearAllImages()Clear all images from thisImageSelectionGroupPanel. All file fields are set to the current working directory. -
getWorkingDirectory
Returns the "current working directory" for this ImageSelectionGroupPanel. When the user chooses a new image to set in the panel, the ImageFileChooser used to select the image starts with the directory set to the current working directory. When the user, using the ImageFileChooser, moves to a different directory, the current working directory is set to the new directory.- Returns:
- the current working directory for this ImageSelectionGroupPanel.
-
setImageFilterClass
Sets the class of image that will be filtered when the user first chooses a new image to set in the panel. The ImageFileChooser used to select the image starts with the correct image filter set.- Parameters:
c- the class of a valid image type to filter, e.g. com.xinapse.multisliceimage.UNC.UNCImage.
-
getImageFilterClass
Returns the class of image that will be filtered when the user first chooses a new image to set in the panel. The ImageFileChooser used to select the image starts with the correct image filter set.- Returns:
- the class of image that will be filtered when the user first chooses a new image to set in the panel.
-
setNImages
public void setNImages(int nImages) Sets the number of ImageSelectionGroupMemberPanels in this group.- Parameters:
nImages- the number of ImageSelectionGroupMemberPanels to be set for this group.
-