Class GUIUtils


  • public class GUIUtils
    extends Object
    Class proviing static utilitits for multiple GUI classes.
    Author:
    Thomas Pfau
    • Constructor Detail

      • GUIUtils

        public GUIUtils()
    • Method Detail

      • createSelectionDescription

        public static JTextPane createSelectionDescription​(String DescriptionString,
                                                           Color background,
                                                           Font font)
        Create a JTextPane that is uneditable and uses background and font as desired.
        Parameters:
        DescriptionString - The Text for the JTextPane
        background - The background Color of the JTextPane
        font - The Font to use.
        Returns:
        An uneditable Textpane with the given DescriptionString, background color and font.
      • getPreferredSize

        public static Dimension getPreferredSize​(JTextComponent comp,
                                                 Dimension origDimension,
                                                 int minwidth)
        Get the preferred size of a JTextComponent given a specific minimal width and its current dimension
        Parameters:
        comp - the component to get the preferred size.
        origDimension - The original Dimension of the component.
        minwidth - The minimal width to use.
        Returns:
        the preferred height for the provided JTextComponent assuming the given minimum width and the actual width from the dimension.
      • createSelectionPanel

        public static JPanel createSelectionPanel​(String SelectionName,
                                                  JComboBox selector,
                                                  Color background)
        Create a SelecionPanel, with a given String and a JCombobox as selector along with a given backrgound color.
        Parameters:
        SelectionName - - The Name for the panel
        selector - - the JComboBox that represents the selection options.
        background - The Color to use as background.
        Returns:
        a JPanel that contains the Descriptor and selector properly aligned.