Class MipavUtil

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

    public class MipavUtil
    extends javax.swing.JComponent
    A collection of static methods and frequently used and useful constants are in this utility class.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MipavUtil.ActionAdapter
      Static abstract class similar to mouseAdapter to allow the catching of actionevents from components without having to implement ActionListener.
      • 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
      static java.awt.Cursor addPointCursor
      Standard cursor: add a point (hand).
      static java.awt.Font arial13
      A 13 point, plain, arial font.
      static java.awt.Font arial13B
      A 13 point, bold, arial font.
      static java.awt.Cursor blankCursor
      Custom cursor: no cursor.
      static java.awt.Font courier10
      A 10 point, plain, courier font.
      static java.awt.Font courier12
      A 12 point, plain, courier font.
      static java.awt.Font courier12B
      A 12 point, bold, courier font.
      static java.awt.Font courier13
      A 13 point, plain, courier font.
      static java.awt.Font courier13B
      A 13 point, bold, courier font.
      static java.awt.Cursor crosshairCursor
      A crosshair cursor.
      static int DEFAULT_ICON_HEIGHT
      DOCUMENT ME!
      static int DEFAULT_ICON_WIDTH
      DOCUMENT ME!
      static java.awt.Font defaultAcceleratorFont
      A 10 point, serif font.
      static java.awt.Dimension defaultButtonSize
      The default size that all buttons should be.
      static java.awt.Cursor defaultCursor
      Standard cursor: default.
      static java.awt.Font defaultMenuFont
      A 12 point, serif font.
      private static java.io.BufferedWriter eyetrackingOutStream
      eye tracking outstream writer .
      static java.awt.Font font10
      A 10 point, plain, serif font.
      static java.awt.Font font12
      A 12 point, plain, serif font.
      static java.awt.Font font12B
      A 12 point, bold, serif font.
      static java.awt.Font font12I
      A 12 point, italic, serif font.
      static java.awt.Font font13
      A 13 point, plain, serif font.
      static java.awt.Font font13B
      A 13 point, bold, serif font.
      static java.awt.Font font13I
      A 13 point, italic, serif font.
      static java.awt.Font font14
      A 14 point, plain, serif font.
      static java.awt.Font font14B
      A 14 point, bold, serif font.
      static java.awt.Font font14I
      A 14 point, italic, serif font.
      static java.awt.Font font16B
      A 16 point, bold, serif font.
      static java.awt.Font font18B
      A 18 point, bold, serif font.
      private static boolean forceQuiet  
      static int[] functionKeys
      DOCUMENT ME!
      static java.awt.Cursor handCursor
      A hand cursor.
      (package private) static javax.help.HelpBroker helpBroker
      DOCUMENT ME!
      (package private) static javax.help.HelpSet hs
      Displays the Java Help dialog indexed directly to the section identified by the ID passed in.
      private static boolean isEyeTrackingEnabled  
      static java.awt.Cursor magnifyCursor
      DOCUMENT ME!
      static java.awt.Cursor magRegionCursor
      Custom cursor: magnify region.
      static int MENU_Y_PADDING
      DOCUMENT ME!
      static java.awt.Cursor moveCursor
      A move cursor.
      static java.awt.Cursor pointCursor
      Standard cursor: point (resize, NE).
      static java.awt.Cursor probeCursor
      DOCUMENT ME!
      static java.awt.Cursor quickLUTcursor
      Custom cursor: quick LUT.
      static java.awt.Cursor resizeCursor
      A resizing cursor.
      private static long serialVersionUID
      Use serialVersionUID for interoperability.
      static java.awt.Cursor smallPointerCursor
      Custom cursor: small pointer.
      static java.awt.Cursor textCursor
      Cursor for doing annotations.
      static java.awt.Cursor unmagnifyCursor
      DOCUMENT ME!
      protected static java.lang.String version
      The current version number, coded as a String, read and then cached by getVersion().
      static java.awt.Cursor waitCursor
      Standard cursor: wait.
      static java.awt.Cursor wandCursor
      Standard cursor: wand (hand).
      static java.awt.Dimension widenButtonSize
      The horizontally widen size that all buttons should be.
      static java.awt.Cursor winLevelCursor
      DOCUMENT ME!
      • 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
      MipavUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void buildCursors()
      DOCUMENT ME!
      static void buildDefaultFonts()
      This should only be called once when MIPAV starts, and then if the user changes the font options through Program Options to rebuild the fonts used in GUI building.
      static javax.swing.border.TitledBorder buildTitledBorder​(java.lang.String title)
      Builds a titled border with the given title, an etched border, and the proper font and color.
      static void centerInComponent​(java.awt.Component parentComponent, javax.swing.JDialog dialog)
      Sets the location of the dialog to the center of the parent component.
      static void centerInWindow​(java.awt.Window parentWindow, java.awt.Window childWindow)
      Sets the location of the window to the center of the parent window.
      static void centerOnScreen​(java.awt.Window window)
      Sets the location of the window to the center of the screen.
      private static void closeEyeTrackingLogfile()
      close the eye tracking log.
      static java.lang.String convertToFileURL​(java.lang.String filename)
      Convert from a filename to a file URL.
      static javax.swing.JLabel createSliderLabel​(java.lang.String title)
      Creates a label in the proper font and color.
      static java.lang.String decodeStr​(java.lang.String urlStr)
      Decode a URL string using UTF-8 character encoding.
      static void displayError​(java.lang.String error)
      Pops up a message dialog to display an error.
      static void displayInfo​(java.lang.String info)
      Pops up a message dialog to display information.
      static void displayWarning​(java.lang.String warning)
      Pops up a message dialog to display a warning.
      static java.awt.Color extractColor​(java.lang.String preferencesColorString)
      Makes a series of ints, corresponding to a color string stored in the Mipav.preferences file which looks like a color string defined in web pages ("RRGGBB"). and returns a java.awt.Color based on those values.
      static boolean getBoolean​(java.util.StringTokenizer st)
      Get a boolean value from a string tokenizer.
      static double getDouble​(java.util.StringTokenizer st)
      Get a double value from a string tokenizer.
      static float getFloat​(java.util.StringTokenizer st)
      Get a float value from a string tokenizer.
      static boolean getForceQuiet()
      Returns whether all error/warning/info dialogs should be suppressed.
      static long getFreeHeapMemory()
      Return the amount of heap memory still available.
      static java.lang.management.MemoryUsage getHeapMemoryUsage()
      Get an object containing information on the current memory usage.
      static javax.swing.ImageIcon getIcon​(java.lang.String name)
      Finds the icon of the specified name.
      static java.awt.Image getIconImage​(java.lang.String name)
      Finds the image of the specified name.
      static int getInt​(java.util.StringTokenizer st)
      Get an integer value from a string tokenizer.
      static long getMaxHeapMemory()
      Return the maximum amount of heap memory that MIPAV can use.
      static java.lang.String getSVNChangedDate​(java.lang.String svnRevStr)
      Get the date from auto populated SVN date string.
      static java.lang.String getSVNRevisionNum​(java.lang.String svnRevStr)
      Get the revision number from auto populated SVN revision string.
      static long getUsedHeapMemory()
      Return the amount of heap memory that MIPAV is currently using.
      static java.lang.String getVersion()
      Gets the MIPAV Version number from the about.txt file.
      private static void initEyeTrackingLogfile​(java.lang.String defaultDirectory)
      Initialize the file IO for eye tracking log file
      private static void initEyeTrackingLogfile​(java.lang.String defaultDirectory, ViewJComponentEditImage imgComp)
      Initialize the file IO for eye tracking log file
      static boolean inRange​(float min, float max, float num, JPanelPixelExclusionSelector.RangeType rangeFlag)
      Determines if a value is within the given pixel intensity range.
      static boolean isEyeTrackingEnabled()
      Check eye tracking is enabled or not.
      static void loadDynamicLib​(java.lang.String path, java.lang.String name)
      Loads a dynamic library of the given name and path and places it in the Java temp directory.
      static java.lang.String makeColorString​(java.awt.Color aColor)
      Takes a java.awt.Color and forms a string representing its color. the string appears as 6 hex digits and looks like the color coding used in html files, as in: "RRGGBB".
      static java.lang.String makeFloatString​(float number, int decPts)
      Makes a string of a float with a specific number of decimal points.
      static java.lang.String makeHTMLFontString​(java.awt.Color color, java.lang.String name, int size, int style, boolean doU, java.lang.String text)
      DOCUMENT ME!
      static void makeNumericsOnly​(javax.swing.JTextField txt, boolean allowFloatingPoint)
      Takes a text field and forces the text field to accept numbers, backspace and delete-key entries.
      static void makeNumericsOnly​(javax.swing.JTextField txt, boolean allowFloatingPoint, boolean allowNegativeNumbers)
      Takes a txt field, and forces the textfield to accept numbers, backspace and delete-key entries.
      static void openURLInBrowser​(java.lang.String URLString)
      Opens a URL in the user's default browser
      static void setComponentsEnabled​(java.awt.Container container, boolean enabled)
      DOCUMENT ME!
      static void setEyeTrackingEnabled​(boolean enable, java.lang.String fileDir)
      When the plug-in eye tracker record button is clicked, it re-initial the eye tracker csv file recording stream.
      static void setEyeTrackingEnabled​(boolean enable, java.lang.String fileDir, ViewJComponentEditImage imageComp)
      When the plug-in eye tracker record button is clicked, it re-initial the eye tracker csv file recording stream.
      static void setFonts​(java.awt.Component[] comp)
      DOCUMENT ME!
      static void setForceQuiet​(boolean force)
      Sets whether all MIPAV error/warning/info messages should be suppressed (used to skip vm heap max size/plist warning on startup).
      static void showWebHelp​(java.lang.String wikiPage)
      Pops up the MIPAV help for a given wiki help page.
      static boolean testParameter​(java.lang.String str, double minValue, double maxValue)
      Tests that the entered parameter is in range.
      static void writeEyeTrackingLog​(java.lang.String msg)
      Record the eye tracking log message.
      static void writeEyeTrackingLog​(java.lang.String msg, ViewJComponentEditImage imgComp)
      Record the eye tracking log message.
      • 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, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, 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
      • 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, getAccessibleContext, 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
      • defaultMenuFont

        public static java.awt.Font defaultMenuFont
        A 12 point, serif font.
      • defaultAcceleratorFont

        public static java.awt.Font defaultAcceleratorFont
        A 10 point, serif font.
      • font10

        public static java.awt.Font font10
        A 10 point, plain, serif font.
      • font12

        public static java.awt.Font font12
        A 12 point, plain, serif font.
      • font12B

        public static java.awt.Font font12B
        A 12 point, bold, serif font.
      • font12I

        public static java.awt.Font font12I
        A 12 point, italic, serif font.
      • font13

        public static java.awt.Font font13
        A 13 point, plain, serif font.
      • font13B

        public static java.awt.Font font13B
        A 13 point, bold, serif font.
      • font13I

        public static java.awt.Font font13I
        A 13 point, italic, serif font.
      • font14

        public static java.awt.Font font14
        A 14 point, plain, serif font.
      • font14B

        public static java.awt.Font font14B
        A 14 point, bold, serif font.
      • font14I

        public static java.awt.Font font14I
        A 14 point, italic, serif font.
      • font16B

        public static java.awt.Font font16B
        A 16 point, bold, serif font.
      • font18B

        public static java.awt.Font font18B
        A 18 point, bold, serif font.
      • courier10

        public static java.awt.Font courier10
        A 10 point, plain, courier font.
      • courier12

        public static java.awt.Font courier12
        A 12 point, plain, courier font.
      • courier12B

        public static java.awt.Font courier12B
        A 12 point, bold, courier font.
      • courier13

        public static java.awt.Font courier13
        A 13 point, plain, courier font.
      • courier13B

        public static java.awt.Font courier13B
        A 13 point, bold, courier font.
      • arial13

        public static java.awt.Font arial13
        A 13 point, plain, arial font.
      • arial13B

        public static java.awt.Font arial13B
        A 13 point, bold, arial font.
      • defaultCursor

        public static final java.awt.Cursor defaultCursor
        Standard cursor: default.
      • crosshairCursor

        public static final java.awt.Cursor crosshairCursor
        A crosshair cursor.
      • moveCursor

        public static final java.awt.Cursor moveCursor
        A move cursor.
      • pointCursor

        public static final java.awt.Cursor pointCursor
        Standard cursor: point (resize, NE).
      • resizeCursor

        public static final java.awt.Cursor resizeCursor
        A resizing cursor.
      • handCursor

        public static final java.awt.Cursor handCursor
        A hand cursor.
      • blankCursor

        public static java.awt.Cursor blankCursor
        Custom cursor: no cursor.
      • magRegionCursor

        public static java.awt.Cursor magRegionCursor
        Custom cursor: magnify region.
      • addPointCursor

        public static final java.awt.Cursor addPointCursor
        Standard cursor: add a point (hand).
      • smallPointerCursor

        public static java.awt.Cursor smallPointerCursor
        Custom cursor: small pointer.
      • probeCursor

        public static java.awt.Cursor probeCursor
        DOCUMENT ME!
      • magnifyCursor

        public static java.awt.Cursor magnifyCursor
        DOCUMENT ME!
      • unmagnifyCursor

        public static java.awt.Cursor unmagnifyCursor
        DOCUMENT ME!
      • quickLUTcursor

        public static java.awt.Cursor quickLUTcursor
        Custom cursor: quick LUT.
      • textCursor

        public static final java.awt.Cursor textCursor
        Cursor for doing annotations.
      • waitCursor

        public static final java.awt.Cursor waitCursor
        Standard cursor: wait.
      • wandCursor

        public static final java.awt.Cursor wandCursor
        Standard cursor: wand (hand).
      • winLevelCursor

        public static java.awt.Cursor winLevelCursor
        DOCUMENT ME!
      • version

        protected static java.lang.String version
        The current version number, coded as a String, read and then cached by getVersion().
      • defaultButtonSize

        public static final java.awt.Dimension defaultButtonSize
        The default size that all buttons should be.
      • widenButtonSize

        public static final java.awt.Dimension widenButtonSize
        The horizontally widen size that all buttons should be.
      • DEFAULT_ICON_WIDTH

        public static final int DEFAULT_ICON_WIDTH
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • DEFAULT_ICON_HEIGHT

        public static final int DEFAULT_ICON_HEIGHT
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • MENU_Y_PADDING

        public static int MENU_Y_PADDING
        DOCUMENT ME!
      • forceQuiet

        private static boolean forceQuiet
      • functionKeys

        public static final int[] functionKeys
        DOCUMENT ME!
      • hs

        static javax.help.HelpSet hs
        Displays the Java Help dialog indexed directly to the section identified by the ID passed in.
      • helpBroker

        static javax.help.HelpBroker helpBroker
        DOCUMENT ME!
      • isEyeTrackingEnabled

        private static boolean isEyeTrackingEnabled
      • eyetrackingOutStream

        private static java.io.BufferedWriter eyetrackingOutStream
        eye tracking outstream writer .
    • Constructor Detail

      • MipavUtil

        public MipavUtil()
    • Method Detail

      • buildCursors

        public static void buildCursors()
        DOCUMENT ME!
      • buildDefaultFonts

        public static void buildDefaultFonts()
        This should only be called once when MIPAV starts, and then if the user changes the font options through Program Options to rebuild the fonts used in GUI building.
      • buildTitledBorder

        public static final javax.swing.border.TitledBorder buildTitledBorder​(java.lang.String title)
        Builds a titled border with the given title, an etched border, and the proper font and color.
        Parameters:
        title - Title of the border
        Returns:
        The titled border.
      • centerInComponent

        public static void centerInComponent​(java.awt.Component parentComponent,
                                             javax.swing.JDialog dialog)
        Sets the location of the dialog to the center of the parent component.
        Parameters:
        parentComponent - the parent component.
        dialog - the dialog which is to be displayed.
      • centerInWindow

        public static void centerInWindow​(java.awt.Window parentWindow,
                                          java.awt.Window childWindow)
        Sets the location of the window to the center of the parent window.
        Parameters:
        parentWindow - the window where the child will be centered on.
        childWindow - the window that is to be displayed centered on the parent window
      • centerOnScreen

        public static void centerOnScreen​(java.awt.Window window)
        Sets the location of the window to the center of the screen.
        Parameters:
        window - Window that is to be displayed
      • convertToFileURL

        public static final java.lang.String convertToFileURL​(java.lang.String filename)
                                                       throws java.net.MalformedURLException
        Convert from a filename to a file URL.
        Parameters:
        filename - the file name to convert
        Returns:
        the url for the file in string form
        Throws:
        java.net.MalformedURLException - if there is a problem converting the file name
      • createSliderLabel

        public static final javax.swing.JLabel createSliderLabel​(java.lang.String title)
        Creates a label in the proper font and color.
        Parameters:
        title - The title of the label.
        Returns:
        The new label.
      • displayError

        public static void displayError​(java.lang.String error)
        Pops up a message dialog to display an error.

        Use when an operation has failed, preventing some operation critical for MIPAV to continue running normally or an operation can neither be completed nor its errors accomodated.

        Parameters:
        error - the message text of the error
        See Also:
        JOptionPane.showMessageDialog(java.awt.Component, java.lang.Object, java.lang.String, int, javax.swing.Icon)
      • displayInfo

        public static void displayInfo​(java.lang.String info)
        Pops up a message dialog to display information.

        Use for brief notices such as completion of an operation or where to find logging information. It is not meant to notify a user of an error in processing.

        Parameters:
        info - the information string
      • displayWarning

        public static void displayWarning​(java.lang.String warning)
        Pops up a message dialog to display a warning.

        Use when an operation has failed, but the can be completed but the output may display inaccuratly; ie., errors can be accomodated.

        Parameters:
        warning - the message text of the warning.
      • extractColor

        public static java.awt.Color extractColor​(java.lang.String preferencesColorString)
        Makes a series of ints, corresponding to a color string stored in the Mipav.preferences file which looks like a color string defined in web pages ("RRGGBB"). and returns a java.awt.Color based on those values.

        Call with extractColor(Preferences.getProperty("OneOfThoseColors"));

        if preferencesColorString is null, or incomplete, returns black.

        Parameters:
        preferencesColorString - -- this class pre-arranges the colors to be
        Returns:
        java.awt.Color
        See Also:
        Color
      • getBoolean

        public static final boolean getBoolean​(java.util.StringTokenizer st)
                                        throws TokenizerException
        Get a boolean value from a string tokenizer.
        Parameters:
        st - the tokenizer to get the boolean from
        Returns:
        true if the token equals "true" without regard to case
        Throws:
        TokenizerException - thrown if the string retrieved is not a boolean value
      • getFloat

        public static final float getFloat​(java.util.StringTokenizer st)
                                    throws TokenizerException
        Get a float value from a string tokenizer.
        Parameters:
        st - the tokenizer to get the float from
        Returns:
        a float value
        Throws:
        TokenizerException - thrown if the string retrieved is not a float value
      • getDouble

        public static final double getDouble​(java.util.StringTokenizer st)
                                      throws TokenizerException
        Get a double value from a string tokenizer.
        Parameters:
        st - the tokenizer to get the double from
        Returns:
        a double value
        Throws:
        TokenizerException - thrown if the string retrieved is not a double value
      • getIcon

        public static javax.swing.ImageIcon getIcon​(java.lang.String name)
        Finds the icon of the specified name. Uses the PlaceHolder class, which is in the same directory as the icons, to locate the icons.
        Parameters:
        name - name of the icon
        Returns:
        the icon
      • getForceQuiet

        public static boolean getForceQuiet()
        Returns whether all error/warning/info dialogs should be suppressed.
        Returns:
        true/false
      • getIconImage

        public static java.awt.Image getIconImage​(java.lang.String name)
                                           throws java.io.FileNotFoundException
        Finds the image of the specified name. Uses the PlaceHolder class, which is in the same directory as the icons images, to locate the images.
        Parameters:
        name - name of the image
        Returns:
        the image
        Throws:
        java.io.FileNotFoundException - if we can't find the icon file
      • getInt

        public static final int getInt​(java.util.StringTokenizer st)
                                throws TokenizerException
        Get an integer value from a string tokenizer.
        Parameters:
        st - the tokenizer to get the integer from
        Returns:
        a ninteger value
        Throws:
        TokenizerException - thrown if the string retrieved is not an integer value
      • getVersion

        public static java.lang.String getVersion()
        Gets the MIPAV Version number from the about.txt file.
        Returns:
        String version number (in string format)
      • inRange

        public static boolean inRange​(float min,
                                      float max,
                                      float num,
                                      JPanelPixelExclusionSelector.RangeType rangeFlag)
        Determines if a value is within the given pixel intensity range.
        Parameters:
        min - minimum intensity.
        max - maximum intensity.
        num - value to test.
        rangeFlag - (no test, between, outside) the min and max.
        Returns:
        true if num satisfies the test.
      • loadDynamicLib

        public static void loadDynamicLib​(java.lang.String path,
                                          java.lang.String name)
        Loads a dynamic library of the given name and path and places it in the Java temp directory.
      • makeColorString

        public static java.lang.String makeColorString​(java.awt.Color aColor)
        Takes a java.awt.Color and forms a string representing its color. the string appears as 6 hex digits and looks like the color coding used in html files, as in: "RRGGBB".
        Parameters:
        aColor - the color to be converted to a hexidecimal
        Returns:
        hexa-decimal string representing the 8-bit values of an RGB color, in the form of "RRGGBB".
      • makeFloatString

        public static final java.lang.String makeFloatString​(float number,
                                                             int decPts)
        Makes a string of a float with a specific number of decimal points.
        Parameters:
        number - number to be converted to a string
        decPts - the number of decimal points
        Returns:
        string representation of the number
      • makeHTMLFontString

        public static final java.lang.String makeHTMLFontString​(java.awt.Color color,
                                                                java.lang.String name,
                                                                int size,
                                                                int style,
                                                                boolean doU,
                                                                java.lang.String text)
        DOCUMENT ME!
        Parameters:
        color - Color
        name - String
        size - int
        style - int
        doU - boolean
        text - String
        Returns:
        String
      • makeNumericsOnly

        public static void makeNumericsOnly​(javax.swing.JTextField txt,
                                            boolean allowFloatingPoint)
        Takes a text field and forces the text field to accept numbers, backspace and delete-key entries.
        Parameters:
        txt - Text field to modify.
        allowFloatingPoint - true will force the text field to also allow the use of the '.' key to permit entering floating point numbers.
      • makeNumericsOnly

        public static void makeNumericsOnly​(javax.swing.JTextField txt,
                                            boolean allowFloatingPoint,
                                            boolean allowNegativeNumbers)
        Takes a txt field, and forces the textfield to accept numbers, backspace and delete-key entries. Arguments to the method can permit the text field to also allow the entry to be negative or give it a floating point decimal value. All other characters are ignored, so if further action is required, it will need to be custom-assigned by the calling object.
        Parameters:
        txt - the text field to make only accept numeric text
        allowFloatingPoint - true will forces the text field to also allow the use of the '.' key to permit entering floating point numbers
        allowNegativeNumbers - true causes textfield to allow the entry of a single minus sign ('-') in front of the text. An additional '-' removes minus sign from the field to give it the opposite sign.
      • setComponentsEnabled

        public static final void setComponentsEnabled​(java.awt.Container container,
                                                      boolean enabled)
        DOCUMENT ME!
        Parameters:
        container - DOCUMENT ME!
        enabled - DOCUMENT ME!
      • setFonts

        public static final void setFonts​(java.awt.Component[] comp)
        DOCUMENT ME!
        Parameters:
        comp - DOCUMENT ME!
      • setForceQuiet

        public static final void setForceQuiet​(boolean force)
        Sets whether all MIPAV error/warning/info messages should be suppressed (used to skip vm heap max size/plist warning on startup).
        Parameters:
        force - Should mipav suppress all errors
      • showWebHelp

        public static void showWebHelp​(java.lang.String wikiPage)
        Pops up the MIPAV help for a given wiki help page.
        Parameters:
        wikiPage - The name of the wiki help topic to open.
      • openURLInBrowser

        public static void openURLInBrowser​(java.lang.String URLString)
        Opens a URL in the user's default browser
        Parameters:
        URLString - The full URL of the web page to open.
      • testParameter

        public static final boolean testParameter​(java.lang.String str,
                                                  double minValue,
                                                  double maxValue)
        Tests that the entered parameter is in range.
        Parameters:
        str - the value entered by the user
        minValue - the minimum value this variable may be set to
        maxValue - the maximum value this variable may be set to
        Returns:
        boolean result of test
      • getHeapMemoryUsage

        public static java.lang.management.MemoryUsage getHeapMemoryUsage()
        Get an object containing information on the current memory usage.
        Returns:
        Heap memory usage object.
      • getFreeHeapMemory

        public static long getFreeHeapMemory()
        Return the amount of heap memory still available.
        Returns:
        The amount of heap memory still available.
      • getMaxHeapMemory

        public static long getMaxHeapMemory()
        Return the maximum amount of heap memory that MIPAV can use.
        Returns:
        The maximum amount of heap memory available.
      • getUsedHeapMemory

        public static long getUsedHeapMemory()
        Return the amount of heap memory that MIPAV is currently using.
        Returns:
        The amount of heap memory currently being used.
      • isEyeTrackingEnabled

        public static final boolean isEyeTrackingEnabled()
        Check eye tracking is enabled or not.
        Returns:
      • setEyeTrackingEnabled

        public static final void setEyeTrackingEnabled​(boolean enable,
                                                       java.lang.String fileDir)
        When the plug-in eye tracker record button is clicked, it re-initial the eye tracker csv file recording stream. If the stop button is clicked, stop the current csv file recording stream.
        Parameters:
        enable - enable flag
        fileDir - user selected csv file directory.
      • setEyeTrackingEnabled

        public static final void setEyeTrackingEnabled​(boolean enable,
                                                       java.lang.String fileDir,
                                                       ViewJComponentEditImage imageComp)
        When the plug-in eye tracker record button is clicked, it re-initial the eye tracker csv file recording stream. If the stop button is clicked, stop the current csv file recording stream.
        Parameters:
        enable - enable flag
        fileDir - user selected csv file directory.
      • initEyeTrackingLogfile

        private static void initEyeTrackingLogfile​(java.lang.String defaultDirectory,
                                                   ViewJComponentEditImage imgComp)
        Initialize the file IO for eye tracking log file
      • initEyeTrackingLogfile

        private static void initEyeTrackingLogfile​(java.lang.String defaultDirectory)
        Initialize the file IO for eye tracking log file
      • writeEyeTrackingLog

        public static final void writeEyeTrackingLog​(java.lang.String msg)
        Record the eye tracking log message.
        Parameters:
        msg -
      • writeEyeTrackingLog

        public static final void writeEyeTrackingLog​(java.lang.String msg,
                                                     ViewJComponentEditImage imgComp)
        Record the eye tracking log message.
        Parameters:
        msg -
      • closeEyeTrackingLogfile

        private static void closeEyeTrackingLogfile()
        close the eye tracking log.
      • getSVNRevisionNum

        public static final java.lang.String getSVNRevisionNum​(java.lang.String svnRevStr)
        Get the revision number from auto populated SVN revision string.
        Parameters:
        svnRevStr - String with format $Rev: ##### $
        Returns:
        Only the revision number from the given string.
      • getSVNChangedDate

        public static final java.lang.String getSVNChangedDate​(java.lang.String svnRevStr)
        Get the date from auto populated SVN date string.
        Parameters:
        svnRevStr - String with format resembling $Date: YYYY-MM-DD [...] $
        Returns:
        Only the revision number from the given string.
      • decodeStr

        public static final java.lang.String decodeStr​(java.lang.String urlStr)
        Decode a URL string using UTF-8 character encoding.
        Parameters:
        urlStr - The URL string to decode.
        Returns:
        Decoded URL string or empty string if there was a decoding error.