Class JPanelPixelExclusionSelector

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

    public class JPanelPixelExclusionSelector
    extends javax.swing.JPanel
    implements java.awt.event.ActionListener
    A dialog to permits choosing a range (positive or negative, and floating-point) of values with the intention of the selection indicating a range of values. Includes "Between" cut-off value ranges. It is coded to display the ranges as values for exclusion, but minor rewriting this class to allow operation specific titles.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private class  JPanelPixelExclusionSelector.ExcluderOptionsActionListener
      This class listens to excluder options, changing the available statistics calculation options depending on whether all contours are still closed.
      static class  JPanelPixelExclusionSelector.RangeType  
      • Nested classes/interfaces inherited from class javax.swing.JPanel

        javax.swing.JPanel.AccessibleJPanel
      • 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

      Fields 
      Modifier and Type Field Description
      private javax.swing.JTextField boundA
      The lower bound of the exclusion
      private javax.swing.JTextField boundB
      The upper bound of the exclusion
      private javax.swing.JTextField boundLB
      The lower blue bound of the exclusion
      private javax.swing.JTextField boundLG
      The lower green bound of the exclusion
      private javax.swing.JTextField boundLR
      The lower red bound of the exclusion
      private javax.swing.JTextField boundUB
      The upper blue bound of the exclusion
      private javax.swing.JTextField boundUG
      The upper green bound of the exclusion
      private javax.swing.JTextField boundUR
      The upper red bound of the exclusion
      private JPanelStatisticsList checkBoxPanel
      A reference to the JDialogVOIStatistic or JDialogVOIStats check box panel.
      private boolean doColor  
      private javax.swing.JComboBox excludeSelection
      Lists available exclusion types
      private java.lang.Float lowerLimit
      The lower limit of the exclusion
      private java.lang.Float lowerLimitB  
      private java.lang.Float lowerLimitG  
      private java.lang.Float lowerLimitR  
      private javax.swing.JCheckBox permitExclusion
      Whether pixels will be excluded from a calculation based on intensity values
      private JPanelPixelExclusionSelector.RangeType rangeFlag
      The range type that this pixel exclusion selector covers.
      private static long serialVersionUID
      Use serialVersionUID for interoperability.
      private java.lang.Float upperLimit
      held for switching between states of the exclusion.
      private java.lang.Float upperLimitB  
      private java.lang.Float upperLimitG  
      private java.lang.Float upperLimitR  
      • 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

      Constructors 
      Constructor Description
      JPanelPixelExclusionSelector​(JPanelStatisticsList checkBoxPanel, boolean doColor)
      Creates an exclusion panel which has a checkbox to make the range controls available, a selector to choose the range controls ("Between", "Above" and "Below"), and the range inputs for these controls.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent e)
      When state changes in some elements of the panel, the panel must make display changes; these changes are registered here.
      java.lang.Float getLowerBound()
      Returns the lower bound text as a number.
      java.lang.Float getLowerBoundB()
      Returns the lower bound text as a number.
      java.lang.Float getLowerBoundG()
      Returns the lower bound text as a number.
      java.lang.Float getLowerBoundR()
      Returns the lower bound text as a number.
      JPanelPixelExclusionSelector.RangeType getRangeFlag()  
      java.lang.Float getUpperBound()
      Returns the upper bound text as a number.
      java.lang.Float getUpperBoundB()
      Returns the upper bound text as a number.
      java.lang.Float getUpperBoundG()
      Returns the upper bound text as a number.
      java.lang.Float getUpperBoundR()
      Returns the upper bound text as a number.
      void selectRangeInput()
      Sets the fields' value and accessability based on the state of the drop-down.
      void setLowerBound​(java.lang.String floatValue)
      Set the lower bound from the script dialog.
      void setLowerBoundB​(java.lang.String floatValue)
      Set the lower blue bound from the script dialog.
      void setLowerBoundG​(java.lang.String floatValue)
      Set the lower green bound from the script dialog.
      void setLowerBoundR​(java.lang.String floatValue)
      Set the lower red bound from the script dialog.
      void setUpperBound​(java.lang.String floatValue)
      Set the upper bound from the script dialog.
      void setUpperBoundB​(java.lang.String floatValue)
      Set the upper blue bound from the script dialog.
      void setUpperBoundG​(java.lang.String floatValue)
      Set the upper green bound from the script dialog.
      void setUpperBoundR​(java.lang.String floatValue)
      Set the upper red bound from the script dialog.
      protected void storeLimitValues()
      Tries to store the values held in the text areas to temporary storage.
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • Methods 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, update
      • 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, 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Use serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • boundA

        private javax.swing.JTextField boundA
        The lower bound of the exclusion
      • boundB

        private javax.swing.JTextField boundB
        The upper bound of the exclusion
      • boundLR

        private javax.swing.JTextField boundLR
        The lower red bound of the exclusion
      • boundUR

        private javax.swing.JTextField boundUR
        The upper red bound of the exclusion
      • boundLG

        private javax.swing.JTextField boundLG
        The lower green bound of the exclusion
      • boundUG

        private javax.swing.JTextField boundUG
        The upper green bound of the exclusion
      • boundLB

        private javax.swing.JTextField boundLB
        The lower blue bound of the exclusion
      • boundUB

        private javax.swing.JTextField boundUB
        The upper blue bound of the exclusion
      • excludeSelection

        private final javax.swing.JComboBox excludeSelection
        Lists available exclusion types
      • lowerLimit

        private java.lang.Float lowerLimit
        The lower limit of the exclusion
      • lowerLimitR

        private java.lang.Float lowerLimitR
      • lowerLimitG

        private java.lang.Float lowerLimitG
      • lowerLimitB

        private java.lang.Float lowerLimitB
      • permitExclusion

        private final javax.swing.JCheckBox permitExclusion
        Whether pixels will be excluded from a calculation based on intensity values
      • upperLimit

        private java.lang.Float upperLimit
        held for switching between states of the exclusion.
      • upperLimitR

        private java.lang.Float upperLimitR
      • upperLimitG

        private java.lang.Float upperLimitG
      • upperLimitB

        private java.lang.Float upperLimitB
      • checkBoxPanel

        private final JPanelStatisticsList checkBoxPanel
        A reference to the JDialogVOIStatistic or JDialogVOIStats check box panel.
      • doColor

        private final boolean doColor
    • Constructor Detail

      • JPanelPixelExclusionSelector

        public JPanelPixelExclusionSelector​(JPanelStatisticsList checkBoxPanel,
                                            boolean doColor)
        Creates an exclusion panel which has a checkbox to make the range controls available, a selector to choose the range controls ("Between", "Above" and "Below"), and the range inputs for these controls.
    • Method Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        When state changes in some elements of the panel, the panel must make display changes; these changes are registered here. When state the state of the checkbox changes (from checked to un- or vice-versa), the excluded selection's state is changed and the Exclusion range property is reset.

        Checks state of:

        • Enables or disables the exclusion drop-down and the text boxes based on the state of the checkbox
        • Changes the visibility of the text-boxes based on the state of the exclusion dropdown; "Between" displays both text boxes, "Above" only displays the lower cutoff box, and "Below" displays only the upper cutoff box.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Parameters:
        e - the ChangeEvent to watch.
      • getLowerBound

        public java.lang.Float getLowerBound()
        Returns the lower bound text as a number. May be too negative for some applications.

        There is a side-effect in that when the permitExclusion checkbox is unchecked, the lower bound returned is null. This means that relying on the upperbound also means relying on the text fields being editable as well.

        Returns:
        lower bound text as a Float; null is returned if the panel is not set to be used or one of the text entries is empty or not a number.
      • getLowerBoundR

        public java.lang.Float getLowerBoundR()
        Returns the lower bound text as a number. May be too negative for some applications.

        There is a side-effect in that when the permitExclusion checkbox is unchecked, the lower bound returned is null. This means that relying on the upperbound also means relying on the text fields being editable as well.

        Returns:
        lower bound text as a Float; null is returned if the panel is not set to be used or one of the text entries is empty or not a number.
      • getLowerBoundG

        public java.lang.Float getLowerBoundG()
        Returns the lower bound text as a number. May be too negative for some applications.

        There is a side-effect in that when the permitExclusion checkbox is unchecked, the lower bound returned is null. This means that relying on the upperbound also means relying on the text fields being editable as well.

        Returns:
        lower bound text as a Float; null is returned if the panel is not set to be used or one of the text entries is empty or not a number.
      • getLowerBoundB

        public java.lang.Float getLowerBoundB()
        Returns the lower bound text as a number. May be too negative for some applications.

        There is a side-effect in that when the permitExclusion checkbox is unchecked, the lower bound returned is null. This means that relying on the upperbound also means relying on the text fields being editable as well.

        Returns:
        lower bound text as a Float; null is returned if the panel is not set to be used or one of the text entries is empty or not a number.
      • getUpperBound

        public java.lang.Float getUpperBound()
        Returns the upper bound text as a number. May be too positive for some applications.

        There is a side-effect in that when the permitExclusion checkbox is unchecked, the upper bound returned is null. This means that relying on the upperbound also means relying on the text fields being editable as well.

        Returns:
        upper bound text as a Float; null is returned if the panel is not set to be used or one of the text entries is empty or not a number.
      • getUpperBoundR

        public java.lang.Float getUpperBoundR()
        Returns the upper bound text as a number. May be too positive for some applications.

        There is a side-effect in that when the permitExclusion checkbox is unchecked, the upper bound returned is null. This means that relying on the upperbound also means relying on the text fields being editable as well.

        Returns:
        upper bound text as a Float; null is returned if the panel is not set to be used or one of the text entries is empty or not a number.
      • getUpperBoundG

        public java.lang.Float getUpperBoundG()
        Returns the upper bound text as a number. May be too positive for some applications.

        There is a side-effect in that when the permitExclusion checkbox is unchecked, the upper bound returned is null. This means that relying on the upperbound also means relying on the text fields being editable as well.

        Returns:
        upper bound text as a Float; null is returned if the panel is not set to be used or one of the text entries is empty or not a number.
      • getUpperBoundB

        public java.lang.Float getUpperBoundB()
        Returns the upper bound text as a number. May be too positive for some applications.

        There is a side-effect in that when the permitExclusion checkbox is unchecked, the upper bound returned is null. This means that relying on the upperbound also means relying on the text fields being editable as well.

        Returns:
        upper bound text as a Float; null is returned if the panel is not set to be used or one of the text entries is empty or not a number.
      • selectRangeInput

        public void selectRangeInput()
        Sets the fields' value and accessability based on the state of the drop-down. "Above" will display an uneditable "max" value and the lesser of the two values, "Below" will display an uneditable "min" value and the larger of the two values and "Between" will display the largest possible values, if the fields have not been set, or will reset the fields to the stored values.
      • setLowerBound

        public void setLowerBound​(java.lang.String floatValue)
        Set the lower bound from the script dialog.
        Parameters:
        floatValue - lower bound string
      • setLowerBoundR

        public void setLowerBoundR​(java.lang.String floatValue)
        Set the lower red bound from the script dialog.
        Parameters:
        floatValue - lower red bound string
      • setLowerBoundG

        public void setLowerBoundG​(java.lang.String floatValue)
        Set the lower green bound from the script dialog.
        Parameters:
        floatValue - lower green bound string
      • setLowerBoundB

        public void setLowerBoundB​(java.lang.String floatValue)
        Set the lower blue bound from the script dialog.
        Parameters:
        floatValue - lower blue bound string
      • setUpperBound

        public void setUpperBound​(java.lang.String floatValue)
        Set the upper bound from the script dialog.
        Parameters:
        floatValue - Maximum value string
      • setUpperBoundR

        public void setUpperBoundR​(java.lang.String floatValue)
        Set the upper red bound from the script dialog.
        Parameters:
        floatValue - Maximum red value string
      • setUpperBoundG

        public void setUpperBoundG​(java.lang.String floatValue)
        Set the upper green bound from the script dialog.
        Parameters:
        floatValue - Maximum green value string
      • setUpperBoundB

        public void setUpperBoundB​(java.lang.String floatValue)
        Set the upper blue bound from the script dialog.
        Parameters:
        floatValue - Maximum blue value string
      • storeLimitValues

        protected void storeLimitValues()
        Tries to store the values held in the text areas to temporary storage. It only does so if there are valid (that is, numbers and that they are neither infinite nor at the maximum or minimum value.
        See Also:
        Float.MAX_VALUE, Float.MIN_VALUE