Package boofcv.gui

Class BoofSwingUtil


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

      Constructors 
      Constructor Description
      BoofSwingUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addToRecentFiles​(java.awt.Component parent, java.lang.String name, java.util.List<java.lang.String> filePaths)  
      static void addToRecentFiles​(java.lang.String preferenceName, java.lang.String name, java.util.List<java.lang.String> filePaths)  
      static void antialiasing​(java.awt.Graphics2D g2)
      Sets rendering hints that will enable antialiasing and make sub pixel rendering look good
      static javax.swing.JButton button​(java.lang.String name, java.awt.event.ActionListener action)  
      static javax.swing.JCheckBox checkbox​(java.lang.String name, boolean checked, java.awt.event.ActionListener action)  
      static void checkGuiThread()  
      static javax.swing.JButton createButtonIcon​(java.lang.String path, int width, int height, boolean opaque)  
      static javax.swing.JButton createButtonIconGUI​(java.lang.String path, int width, int height)  
      static javax.swing.JMenuItem createMenuItem​(java.lang.String name, int mnmonic, int accelerator, boofcv.misc.BoofLambdas.Process action)  
      static javax.swing.JMenuItem createMenuItem​(java.lang.String name, boofcv.misc.BoofLambdas.Process action)  
      static javax.swing.JFormattedTextField createTextField​(double current, double min, double max)  
      static javax.swing.JFormattedTextField createTextField​(int current, int min, int max)  
      static java.io.File directoryUserHome()  
      static java.io.File ensureSuffix​(java.io.File f, java.lang.String suffix)  
      static java.io.File fileChooser​(java.lang.String preferenceName, java.awt.Component parent, boolean openFile, java.lang.String defaultPath, BoofSwingUtil.FileTypes... filters)  
      static java.io.File fileChooserPreview​(java.lang.String preferenceName, java.awt.Component parent, boolean openFile, java.lang.String defaultPath, BoofSwingUtil.FileTypes... filters)
      File chooser with a preview.
      static java.lang.String getDefaultPath​(java.lang.Object parent, java.lang.String key)  
      static java.util.List<BoofSwingUtil.RecentFiles> getListOfRecentFiles​(java.awt.Component parent)  
      static java.util.List<BoofSwingUtil.RecentFiles> getListOfRecentFiles​(java.lang.String preferenceName)  
      static javax.swing.JPanel gridPanel​(int rows, int cols, int hgap, int vgap, java.awt.Component... children)  
      static javax.swing.JPanel gridPanel​(int cols, java.awt.Component... children)  
      static void invokeNowOrLater​(java.lang.Runnable r)  
      static boolean isMiddleMouseButton​(java.awt.event.MouseEvent e)  
      static boolean isRightClick​(java.awt.event.MouseEvent e)  
      static double mouseWheelImageZoom​(double scale, java.awt.event.MouseWheelEvent e)  
      static java.io.File openFileChooser​(java.awt.Component parent, BoofSwingUtil.FileTypes... filters)  
      static java.io.File openFileChooser​(java.awt.Component parent, java.lang.String defaultPath, BoofSwingUtil.FileTypes... filters)  
      static java.io.File openFileChooser​(java.lang.String preferenceName, BoofSwingUtil.FileTypes... filters)
      Opens a file choose when there is no parent component.
      static java.io.File openFilePreview​(java.awt.Component parent, BoofSwingUtil.FileTypes... filters)  
      static java.io.File openFilePreview​(java.lang.String preferenceName, BoofSwingUtil.FileTypes... filters)  
      static java.lang.String[] openImageSetChooser​(java.awt.Window parent, OpenImageSetDialog.Mode mode, int numberOfImages)  
      static OpenStereoSequencesChooser.Selected openStereoChooser​(java.awt.Window parent, boolean isSequence)  
      static void recursiveEnable​(javax.swing.JComponent panel, java.lang.Boolean isEnabled)  
      static void saveDefaultPath​(java.lang.Object parent, java.lang.String key, java.io.File file)  
      static void saveDisparityDialog​(javax.swing.JComponent owner, java.lang.String key, boofcv.struct.image.ImageGray d)
      Opens a dialog, asks the user where to save the disparity image, converts the image into a U16 format, saves it as a PNG
      static java.io.File saveFileChooser​(java.awt.Component parent, BoofSwingUtil.FileTypes... filters)  
      static void saveListSe3Dialog​(java.awt.Component owner, java.lang.String key, boofcv.visualize.PointCloudViewer pcv)
      Opens a dialog, asks the user where to save the sequence of Se3
      static void savePointCloudDialog​(java.awt.Component owner, java.lang.String key, boofcv.visualize.PointCloudViewer pcv)
      Opens a dialog, asks the user where to save the point cloud, then saves the point cloud
      static double selectZoomToFitInDisplay​(int width, int height)
      Figures out what the scale should be to fit the window inside the default display
      static double selectZoomToShowAll​(javax.swing.JComponent panel, int width, int height)
      Select a zoom which will allow the entire image to be shown in the panel
      static void setMenuItemKeys​(javax.swing.JMenuItem menu, int mnmonic, int accelerator)  
      static void warningDialog​(java.awt.Component component, java.lang.Exception e)  
      • Methods inherited from class java.lang.Object

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

      • BoofSwingUtil

        public BoofSwingUtil()
    • Method Detail

      • isRightClick

        public static boolean isRightClick​(java.awt.event.MouseEvent e)
      • isMiddleMouseButton

        public static boolean isMiddleMouseButton​(java.awt.event.MouseEvent e)
      • mouseWheelImageZoom

        public static double mouseWheelImageZoom​(double scale,
                                                 java.awt.event.MouseWheelEvent e)
      • recursiveEnable

        public static void recursiveEnable​(javax.swing.JComponent panel,
                                           java.lang.Boolean isEnabled)
      • ensureSuffix

        public static java.io.File ensureSuffix​(java.io.File f,
                                                java.lang.String suffix)
      • saveFileChooser

        public static java.io.File saveFileChooser​(java.awt.Component parent,
                                                   BoofSwingUtil.FileTypes... filters)
      • openImageSetChooser

        public static java.lang.String[] openImageSetChooser​(java.awt.Window parent,
                                                             OpenImageSetDialog.Mode mode,
                                                             int numberOfImages)
      • getDefaultPath

        public static java.lang.String getDefaultPath​(java.lang.Object parent,
                                                      java.lang.String key)
      • saveDefaultPath

        public static void saveDefaultPath​(java.lang.Object parent,
                                           java.lang.String key,
                                           java.io.File file)
      • openFileChooser

        public static java.io.File openFileChooser​(java.lang.String preferenceName,
                                                   BoofSwingUtil.FileTypes... filters)
        Opens a file choose when there is no parent component. Instead a string can be passed in so that the preference is specific to the application still
      • openFilePreview

        public static java.io.File openFilePreview​(java.lang.String preferenceName,
                                                   BoofSwingUtil.FileTypes... filters)
      • openFileChooser

        public static java.io.File openFileChooser​(java.awt.Component parent,
                                                   BoofSwingUtil.FileTypes... filters)
      • openFilePreview

        public static java.io.File openFilePreview​(java.awt.Component parent,
                                                   BoofSwingUtil.FileTypes... filters)
      • openFileChooser

        public static java.io.File openFileChooser​(java.awt.Component parent,
                                                   java.lang.String defaultPath,
                                                   BoofSwingUtil.FileTypes... filters)
      • fileChooser

        public static java.io.File fileChooser​(java.lang.String preferenceName,
                                               java.awt.Component parent,
                                               boolean openFile,
                                               java.lang.String defaultPath,
                                               BoofSwingUtil.FileTypes... filters)
      • fileChooserPreview

        public static java.io.File fileChooserPreview​(java.lang.String preferenceName,
                                                      java.awt.Component parent,
                                                      boolean openFile,
                                                      java.lang.String defaultPath,
                                                      BoofSwingUtil.FileTypes... filters)
        File chooser with a preview. Work in progress for replacing the old file chooser
      • getListOfRecentFiles

        public static java.util.List<BoofSwingUtil.RecentFiles> getListOfRecentFiles​(java.awt.Component parent)
      • getListOfRecentFiles

        public static java.util.List<BoofSwingUtil.RecentFiles> getListOfRecentFiles​(java.lang.String preferenceName)
      • addToRecentFiles

        public static void addToRecentFiles​(java.awt.Component parent,
                                            java.lang.String name,
                                            java.util.List<java.lang.String> filePaths)
      • addToRecentFiles

        public static void addToRecentFiles​(java.lang.String preferenceName,
                                            java.lang.String name,
                                            java.util.List<java.lang.String> filePaths)
      • invokeNowOrLater

        public static void invokeNowOrLater​(java.lang.Runnable r)
      • checkGuiThread

        public static void checkGuiThread()
      • selectZoomToShowAll

        public static double selectZoomToShowAll​(javax.swing.JComponent panel,
                                                 int width,
                                                 int height)
        Select a zoom which will allow the entire image to be shown in the panel
      • selectZoomToFitInDisplay

        public static double selectZoomToFitInDisplay​(int width,
                                                      int height)
        Figures out what the scale should be to fit the window inside the default display
      • gridPanel

        public static javax.swing.JPanel gridPanel​(int cols,
                                                   java.awt.Component... children)
      • gridPanel

        public static javax.swing.JPanel gridPanel​(int rows,
                                                   int cols,
                                                   int hgap,
                                                   int vgap,
                                                   java.awt.Component... children)
      • createTextField

        public static javax.swing.JFormattedTextField createTextField​(int current,
                                                                      int min,
                                                                      int max)
      • createTextField

        public static javax.swing.JFormattedTextField createTextField​(double current,
                                                                      double min,
                                                                      double max)
      • createMenuItem

        public static javax.swing.JMenuItem createMenuItem​(java.lang.String name,
                                                           int mnmonic,
                                                           int accelerator,
                                                           boofcv.misc.BoofLambdas.Process action)
      • createMenuItem

        public static javax.swing.JMenuItem createMenuItem​(java.lang.String name,
                                                           boofcv.misc.BoofLambdas.Process action)
      • setMenuItemKeys

        public static void setMenuItemKeys​(javax.swing.JMenuItem menu,
                                           int mnmonic,
                                           int accelerator)
      • warningDialog

        public static void warningDialog​(java.awt.Component component,
                                         java.lang.Exception e)
      • antialiasing

        public static void antialiasing​(java.awt.Graphics2D g2)
        Sets rendering hints that will enable antialiasing and make sub pixel rendering look good
        Parameters:
        g2 -
      • createButtonIconGUI

        public static javax.swing.JButton createButtonIconGUI​(java.lang.String path,
                                                              int width,
                                                              int height)
      • createButtonIcon

        public static javax.swing.JButton createButtonIcon​(java.lang.String path,
                                                           int width,
                                                           int height,
                                                           boolean opaque)
      • button

        public static javax.swing.JButton button​(java.lang.String name,
                                                 java.awt.event.ActionListener action)
      • checkbox

        public static javax.swing.JCheckBox checkbox​(java.lang.String name,
                                                     boolean checked,
                                                     java.awt.event.ActionListener action)
      • directoryUserHome

        public static java.io.File directoryUserHome()
      • savePointCloudDialog

        public static void savePointCloudDialog​(java.awt.Component owner,
                                                java.lang.String key,
                                                boofcv.visualize.PointCloudViewer pcv)
        Opens a dialog, asks the user where to save the point cloud, then saves the point cloud
      • saveListSe3Dialog

        public static void saveListSe3Dialog​(java.awt.Component owner,
                                             java.lang.String key,
                                             boofcv.visualize.PointCloudViewer pcv)
        Opens a dialog, asks the user where to save the sequence of Se3
      • saveDisparityDialog

        public static void saveDisparityDialog​(javax.swing.JComponent owner,
                                               java.lang.String key,
                                               boofcv.struct.image.ImageGray d)
        Opens a dialog, asks the user where to save the disparity image, converts the image into a U16 format, saves it as a PNG