Class Utils


  • public class Utils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Utils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static javax.swing.JButton getButton​(java.lang.String resource)
      Creates a JButton with a text, tooltip and a key modifier as needed
      (package private) static java.lang.String getCapitalized​(java.lang.String word)
      Create a String where the first letter is written with a uppercase.
      (package private) static java.lang.String getInvertedCapitalizion​(java.lang.String word)
      Create a String with inverted case for the first letter.
      (package private) static javax.swing.JLabel getLabel​(java.lang.String text)
      Creates a JLabel as needed
      (package private) static javax.swing.JList getList()
      Creates a JList as needed
      (package private) static java.lang.String getResource​(java.lang.String value)
      Translate a GUI string in one of the supported languages.
      (package private) static javax.swing.JTextField getTextField()
      Creates a JTextField as needed
      (package private) static boolean isAllCapitalized​(java.lang.String word)
      Check if all letter are uppercase.
      (package private) static boolean isFirstCapitalized​(java.lang.String word)
      Check if the first character is a uppcase letter
      (package private) static boolean isIncludeNumbers​(java.lang.String word)
      Check if the word include a digit.
      static java.lang.String replaceUnicodeQuotation​(java.lang.String word)
      Check and replace Unicode variants of quotation marks and hyphens.
      (package private) static void setDialogIcon​(javax.swing.JDialog dlg)
      Set the Icon for an dialog
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Utils

        public Utils()
    • Method Detail

      • getResource

        static java.lang.String getResource​(java.lang.String value)
        Translate a GUI string in one of the supported languages. If the value was not find then the key is returned.
        Parameters:
        value - the key of the language resource.
        Returns:
        the translation result
      • getButton

        static javax.swing.JButton getButton​(java.lang.String resource)
        Creates a JButton with a text, tooltip and a key modifier as needed
        Parameters:
        resource - the key of the language resource.
        Returns:
        a new JButton based on the resource
      • getTextField

        static javax.swing.JTextField getTextField()
        Creates a JTextField as needed
        Returns:
        a new JTextField based on the resource
      • getLabel

        static javax.swing.JLabel getLabel​(java.lang.String text)
        Creates a JLabel as needed
        Parameters:
        text - The text to be on the label
        Returns:
        a new JLabel based on the resource
      • getList

        static javax.swing.JList getList()
        Creates a JList as needed
        Returns:
        a new JList based on the resource
      • setDialogIcon

        static void setDialogIcon​(javax.swing.JDialog dlg)
        Set the Icon for an dialog
        Parameters:
        dlg - the dialog
      • getCapitalized

        static java.lang.String getCapitalized​(java.lang.String word)
        Create a String where the first letter is written with a uppercase.
        Parameters:
        word - the word that should be change
        Returns:
        the new String if needed
      • getInvertedCapitalizion

        static java.lang.String getInvertedCapitalizion​(java.lang.String word)
        Create a String with inverted case for the first letter. If it is lowercase then it will change to uppercase and vice versa.
        Parameters:
        word - the word that should be change
        Returns:
        the new String if needed
      • isFirstCapitalized

        static boolean isFirstCapitalized​(java.lang.String word)
        Check if the first character is a uppcase letter
        Parameters:
        word - the word that should be check. It can not be null.
        Returns:
        true if the first character is a uppercase letter
      • isAllCapitalized

        static boolean isAllCapitalized​(java.lang.String word)
        Check if all letter are uppercase. Character that are not letters are ignored.
        Parameters:
        word - the word that should be check. It can not be null or empty.
        Returns:
        if all character are a uppercase letter
      • isIncludeNumbers

        static boolean isIncludeNumbers​(java.lang.String word)
        Check if the word include a digit.
        Parameters:
        word - the word that should be check. It can not be null.
        Returns:
        if there is any number in the word.
      • replaceUnicodeQuotation

        public static java.lang.String replaceUnicodeQuotation​(java.lang.String word)
        Check and replace Unicode variants of quotation marks and hyphens. Unicode characters for general punctuation can be seen here: http://www.unicodemap.org/range/40/General_Punctuation/
        Parameters:
        word - the word that should be check. It can not be null.
        Returns:
        A new string of the same length as the original.