Class SwingUtil

java.lang.Object
org.locationtech.jtstest.testbuilder.ui.SwingUtil

public class SwingUtil extends Object
  • Field Details

    • XML_FILE_FILTER

      public static FileFilter XML_FILE_FILTER
    • JAVA_FILE_FILTER

      public static FileFilter JAVA_FILE_FILTER
    • PNG_FILE_FILTER

      public static FileFilter PNG_FILE_FILTER
  • Constructor Details

    • SwingUtil

      public SwingUtil()
  • Method Details

    • createFileFilter

      public static FileFilter createFileFilter(String description, String extension)
      Example usage:
       SwingUtil.createFileFilter("JEQL script (*.jql)", "jql")
       
      Parameters:
      description -
      extension -
      Returns:
      the file filter
    • chooseFilenameWithConfirm

      public static String chooseFilenameWithConfirm(Component comp, JFileChooser fileChooser)
      Parameters:
      comp -
      fileChooser -
      Returns:
      filename chosen, or null if choose was cancelled for some reason
    • confirmOverwrite

      public static boolean confirmOverwrite(Component comp, File file)
    • setEnabledWithBackground

      public static void setEnabledWithBackground(Component comp, boolean isEnabled)
    • coerce

      public static Object coerce(Object val, Class clz)
    • convertInteger

      public static Integer convertInteger(String str)
    • convertDouble

      public static Double convertDouble(String str)
    • getInteger

      public static Integer getInteger(JTextField txt, Integer defaultVal)
    • getDouble

      public static Double getDouble(JTextField txt, Double defaultVal)
    • value

      public static String value(JTextComponent txt)
    • value

      public static Object value(JComboBox cb, Object[] val)
    • copyToClipboard

      public static void copyToClipboard(Object o, boolean isFormatted)
    • getFromClipboard

      public static Object getFromClipboard()
    • getContents

      public static Transferable getContents(Clipboard clipboard)
    • reportException

      public static void reportException(Component c, Exception e)
    • createButton

      public static JButton createButton(ImageIcon icon, String tip, ActionListener action)
    • createButton

      public static JButton createButton(String title, String tip, ActionListener action)