Package com.xinapse.image
Class InputImageSelectionPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.xinapse.image.ImageSelectionPanel
com.xinapse.image.InputImageSelectionPanel
- All Implemented Interfaces:
com.xinapse.util.CanLoadImage,MessageShower,ImageObserver,MenuContainer,Serializable,Accessible
public class InputImageSelectionPanel
extends ImageSelectionPanel
implements com.xinapse.util.CanLoadImage
A component that can be used to select a
ReadableImage for input.
The ReadableImage file can be selected either by pressing a button (with an
icon on it) and selecting the file via an ImageFileChooser, or by editing the
text fields that select the directory (folder) and file name, or by drag-and-drop.- See Also:
-
Nested Class Summary
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
Fields inherited from class com.xinapse.image.ImageSelectionPanel
currentWorkingDirectory, fileLabel, fileSelectionPanel, fileTextField, folderLabel, folderTextField, imageChooser, imageClassToFilter, setImageButtonFields 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
ConstructorsConstructorDescriptionInputImageSelectionPanel(MessageShower messageShower) Creates new InputImageSelectionPanel, with the default Folder set to the System Propertyuser.dir.InputImageSelectionPanel(MessageShower messageShower, boolean oneLine) Creates new InputImageSelectionPanel, with the default Folder set to the System Propertyuser.dir, and with the image file selection field on only one line.InputImageSelectionPanel(MessageShower messageShower, File f, Class<? extends ReadableImage> imageClassToFilter, boolean oneLine) Creates new InputImageSelectionPanel, with the default Folder given by argument, and with the image file selection field optionally on only one line. -
Method Summary
Modifier and TypeMethodDescriptionvoidDoes nothing.Returns the name of the image set in this ImageSelectionPanel.Override the default getPreferredSize() method.Returns theReadableImagethat has been set in thisInputImageSelectionPanel.booleanTests whether thisCanLoadImageis currently loading an image.booleanloadImage(ReadableImage image, com.xinapse.util.ImageLoaderWorker imageLoaderWorker) Load an image into thisCanLoadImage.voidsetEditable(boolean editable) Sets whether text for folder/file selection is editable.voidsetEnabled(boolean b) Enables or disables thisImageSelectionPanel, depending on the value of the parameterb.voidSets the file in thisImageSelectionPanelto the specified file.voidsetFileText(String text) Sets the text for the file selection text field.booleanUnloads the image set in this InputImageSelectionPanel.Methods inherited from class com.xinapse.image.ImageSelectionPanel
addFileChangeCommitListener, addFileTextEditListener, busyCursors, getFile, getParentWindow, getWorkingDirectory, readyCursors, removeFileChangeCommitListener, removeFileTextEditListener, setFileLabel, setFileToolTipText, setFolderLabel, setFolderText, setFolderToolTipText, setImageButtonToolTipText, setImageFilterClass, setToolTipText, setWorkingDirectory, showError, showError, showStatus, showSuppressibleErrorMethods 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, 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, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, 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, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.xinapse.util.CanLoadImage
busyCursors, getParentWindow, readyCursors, showError, showError, showStatus
-
Constructor Details
-
InputImageSelectionPanel
Creates new InputImageSelectionPanel, with the default Folder set to the System Propertyuser.dir.- Parameters:
messageShower- the MessageShower that will show error and status messages, etc.
-
InputImageSelectionPanel
Creates new InputImageSelectionPanel, with the default Folder set to the System Propertyuser.dir, and with the image file selection field on only one line.- Parameters:
messageShower- the MessageShower that will show error and status messages, etc.oneLine- if the InputImageSelectionPanel is to appear on only one line.
-
InputImageSelectionPanel
public InputImageSelectionPanel(MessageShower messageShower, File f, Class<? extends ReadableImage> imageClassToFilter, boolean oneLine) Creates new InputImageSelectionPanel, with the default Folder given by argument, and with the image file selection field optionally on only one line.- Parameters:
messageShower- the MessageShower that will show error and status messages, etc.f- used to set the default folder for the image. Iffis a directory, then the default folder is set tof. Iffis a regular file, the default folder is set to the parent directory off. Iffis null, then the default folder is set to the System Propertyuser.dir.imageClassToFilter- theClassof the image (e.g.com.xinapse.multisliceimage.UNC.UNCImage.class) that will be the default image type to filter on.oneLine- if theInputImageSelectionPanelis to appear on only one line.
-
-
Method Details
-
getPreferredSize
Override the default getPreferredSize() method.- Overrides:
getPreferredSizein classImageSelectionPanel- Returns:
- the preferred size of the component.
-
setFile
Description copied from class:ImageSelectionPanelSets the file in thisImageSelectionPanelto the specified file.- Overrides:
setFilein classImageSelectionPanel- Parameters:
f- the file to set.
-
setFileText
Description copied from class:ImageSelectionPanelSets the text for the file selection text field.- Overrides:
setFileTextin classImageSelectionPanel- Parameters:
text- the text for the file selection text field.
-
getReadableImage
Returns theReadableImagethat has been set in thisInputImageSelectionPanel. If no image has been set, then aUnsetFileExceptionis thrown. If the Folder field is blank, then the File is constructed using the System Property "user.dir" as the parent directory of the returned File.- Returns:
- the
ReadableImagethat has been set in thisInputImageSelectionPanel. - Throws:
UnsetImageException- if no ReadableImage has been set.InvalidImageException- if the image set does not yield a valid ReadableImage.
-
getImageName
Description copied from class:ImageSelectionPanelReturns the name of the image set in this ImageSelectionPanel.- Overrides:
getImageNamein classImageSelectionPanel- Returns:
- the name of the image set in this ImageSelectionPanel.
- Throws:
UnsetImageException- if an image has not been set.
-
setEditable
public void setEditable(boolean editable) Sets whether text for folder/file selection is editable. If it is not editable, then the user must select a new file by pressing the button with the icon on.- Parameters:
editable- iftruethen the text fields will be editable; not editable otherwise.
-
loadImage
Description copied from interface:com.xinapse.util.CanLoadImageLoad an image into thisCanLoadImage.- Specified by:
loadImagein interfacecom.xinapse.util.CanLoadImage- Parameters:
image- the image to load.imageLoaderWorker- the ImageLoaderWorker that loads the image.- Returns:
- true if the image was loaded successfully; false otherwise.
-
doPostLoad
public void doPostLoad()Does nothing.- Specified by:
doPostLoadin interfacecom.xinapse.util.CanLoadImage
-
unloadImage
public boolean unloadImage()Unloads the image set in this InputImageSelectionPanel.- Specified by:
unloadImagein interfacecom.xinapse.util.CanLoadImage- Returns:
- true because the image unload is always successful.
-
isLoadInProgress
public boolean isLoadInProgress()Description copied from interface:com.xinapse.util.CanLoadImageTests whether thisCanLoadImageis currently loading an image.- Specified by:
isLoadInProgressin interfacecom.xinapse.util.CanLoadImage- Returns:
trueif an image is currently being loaded;falseotherwise.
-
setEnabled
public void setEnabled(boolean b) Description copied from class:ImageSelectionPanelEnables or disables thisImageSelectionPanel, depending on the value of the parameterb. An enabledImageSelectionPanelcan respond to user input and generate events.- Overrides:
setEnabledin classImageSelectionPanel- Parameters:
b- iftrue, thisImageSelectionPanelis enabled; otherwise it is disabled.
-