Class SwingTools

java.lang.Object
eu.bandm.tools.graficUtils.SwingTools

public class SwingTools extends Object
Collection of small static utility functions.
  • Method Details

    • setMaximumToPreferred

      public static void setMaximumToPreferred(Component c)
    • nearestContainer

      @Opt public static <C extends Container> C nearestContainer(@Opt @Opt Component c, Class<C> cl)
    • show

      public static <D extends Message> void show(JFrame frame, @Opt @Opt String windowtitle, int messageType, MessageStore<D> text, String buttonText)
    • show

      public static void show(JFrame frame, @Opt @Opt String windowtitle, int messageType, Object[] text, String buttonText)
      ATTENTION: when calling "showXXDialog()", the conversion to "Object[]" must be done explicitly, because only then "vertical stacking" is applied to the results of "toString()" separately!
    • ask

      public static <D extends Message> boolean ask(JFrame frame, @Opt @Opt String windowtitle, int messageType, MessageStore<D> text, String cancelbutton, String okbutton)
    • ask

      public static boolean ask(JFrame frame, @Opt @Opt String windowtitle, int messageType, Object[] text, String cancelbutton, String okbutton)
    • appendFileToTextArea

      public static int appendFileToTextArea(File file, JTextArea ta) throws IOException
      Throws:
      IOException
    • loadPngsToButtons

      public static int loadPngsToButtons(JPanel container, File directory, String fileStem, int numStart, String numberFormat)
      Load one or more ".png" files to JButtons and append them to the end of the container. In case of lilypond use "-page%d" as the numberFormat.
      Returns:
      -1 if ONE page without numeric extension has been loaded; otherwise the first number which could NOT be loaded (e.g. "3" if pages "1" and "2" have been successfully loaded)