Class SelectFromListDialog<T>

    • Constructor Detail

      • SelectFromListDialog

        public SelectFromListDialog​(java.lang.String title,
                                    java.lang.String prompt,
                                    java.util.List<T> list,
                                    java.util.function.Function<T,​java.lang.String> toStringFunc)
    • Method Detail

      • selectFromList

        public static <T> T selectFromList​(java.util.List<T> list,
                                           java.lang.String title,
                                           java.lang.String prompt,
                                           java.util.function.Function<T,​java.lang.String> toStringFunc)
        Modally shows the user a dialog with a list of strings, and returns the picked object.

        (automatically switches to Swing thread)

        Parameters:
        list - list of object of type T
        title - title of dialog
        prompt - prompt shown above list
        toStringFunc - func that converts a T into a String.
        Returns:
        the chosen T object, or null if dialog canceled.
      • getSelectedObject

        public T getSelectedObject()