Package boofcv.gui

Class BoofSwingUtil

java.lang.Object
boofcv.gui.BoofSwingUtil

public class BoofSwingUtil extends Object
  • Field Details

  • Constructor Details

    • BoofSwingUtil

      public BoofSwingUtil()
  • Method Details

    • initializeSwing

      public static void initializeSwing()
      Standard initialization of Swing for applications
    • setVerboseWithDemoSettings

      public static void setVerboseWithDemoSettings(VerbosePrint v)
    • isRightClick

      public static boolean isRightClick(MouseEvent e)
    • isMiddleMouseButton

      public static boolean isMiddleMouseButton(MouseEvent e)
    • mouseWheelImageZoom

      public static double mouseWheelImageZoom(double scale, MouseWheelEvent e)
    • recursiveEnable

      public static void recursiveEnable(JComponent panel, Boolean isEnabled)
    • ensureSuffix

      public static File ensureSuffix(File f, String suffix)
    • saveFileChooser

      @Nullable public static @Nullable File saveFileChooser(Component parent, BoofSwingUtil.FileTypes... filters)
    • openImageSetChooser

      @Nullable public static @Nullable String[] openImageSetChooser(@Nullable @Nullable Window parent, OpenImageSetDialog.Mode mode, int numberOfImages)
    • openStereoChooser

      @Nullable public static OpenStereoSequencesChooser.Selected openStereoChooser(Window parent, @Nullable @Nullable Class<?> owner, boolean isSequence, boolean justImages)
    • getDefaultPath

      public static String getDefaultPath(@Nullable @Nullable Object parent, @Nullable @Nullable String key)
    • saveDefaultPath

      public static void saveDefaultPath(@Nullable @Nullable Object parent, @Nullable @Nullable String key, File file)
    • openFileChooser

      @Nullable public static @Nullable File openFileChooser(@Nullable @Nullable 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

      @Nullable public static @Nullable File openFilePreview(@Nullable @Nullable String preferenceName, BoofSwingUtil.FileTypes... filters)
    • openFileChooser

      @Nullable public static @Nullable File openFileChooser(@Nullable @Nullable Component parent, BoofSwingUtil.FileTypes... filters)
    • openFilePreview

      @Nullable public static @Nullable File openFilePreview(@Nullable @Nullable Component parent, BoofSwingUtil.FileTypes... filters)
    • openFileChooser

      @Nullable public static @Nullable File openFileChooser(@Nullable @Nullable Component parent, String defaultPath, BoofSwingUtil.FileTypes... filters)
    • fileChooser

      @Nullable public static @Nullable File fileChooser(@Nullable @Nullable String preferenceName, @Nullable @Nullable Component parent, boolean openFile, String defaultPath, @Nullable BoofLambdas.MassageString massageName, BoofSwingUtil.FileTypes... filters)
      Opens a file chooser for the specified file types. Previous path is loaded using preferences.
      Parameters:
      massageName - A lambda that lets you change the name of the previous path. Useful when a file type is selected.
    • fileChooserPreview

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

      public static List<BoofSwingUtil.RecentFiles> getListOfRecentFiles(Component parent)
    • getListOfRecentFiles

      public static List<BoofSwingUtil.RecentFiles> getListOfRecentFiles(String preferenceName)
    • addToRecentFiles

      public static void addToRecentFiles(Component parent, String name, List<String> filePaths)
    • addToRecentFiles

      public static void addToRecentFiles(String preferenceName, String name, List<String> filePaths)
    • saveRecentFiles

      public static void saveRecentFiles(String preferenceName, List<BoofSwingUtil.RecentFiles> files)
    • updateRecentItems

      public static void updateRecentItems(JComponent owner, @Nullable @Nullable JMenu menuRecent, BoofLambdas.ProcessObject<BoofSwingUtil.RecentFiles> function)
    • invokeNowOrLater

      public static void invokeNowOrLater(Runnable r)
    • checkGuiThread

      public static void checkGuiThread()
    • checkNotGuiThread

      public static void checkNotGuiThread()
    • selectZoomToShowAll

      public static double selectZoomToShowAll(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 JPanel gridPanel(int cols, Component... children)
    • gridPanel

      public static JPanel gridPanel(int rows, int cols, int hgap, int vgap, Component... children)
    • createTextField

      public static JFormattedTextField createTextField(int current, int min, int max)
    • createTextField

      public static JFormattedTextField createTextField(double current, double min, double max)
    • createHexTextField

      public static JFormattedTextField createHexTextField(long current)
    • wrapBorder

      public static JComponent wrapBorder(JComponent comp)
      Wraps the component in the center of a BorderLayout
    • createMenuItem

      public static JMenuItem createMenuItem(String name, int mnmonic, int accelerator, BoofLambdas.ProcessCall action)
    • createMenuItem

      public static JMenuItem createMenuItem(String name, BoofLambdas.ProcessCall action)
    • setMenuItemKeys

      public static void setMenuItemKeys(JMenuItem menu, int mnemonic, int accelerator)
    • warningDialog

      public static void warningDialog(Component component, Exception e)
    • antialiasing

      public static Graphics2D antialiasing(Graphics g)
      Convenience function which sets rendering hints that the improve rendering quality of 2D graphics and will return the type casted Graphics2D. Potentially converting 3 lines of code into 1 line of code.
    • createButtonIconGUI

      public static JButton createButtonIconGUI(String path, int width, int height)
    • createButtonIcon

      public static JButton createButtonIcon(String path, int width, int height, boolean opaque)
    • button

      public static JButton button(String name, @Nullable @Nullable ActionListener action)
    • checkbox

      public static JCheckBox checkbox(String name, boolean checked, @Nullable @Nullable ActionListener action)
    • directoryUserHome

      public static File directoryUserHome()
    • savePointCloudDialog

      public static void savePointCloudDialog(@Nullable @Nullable Component owner, @Nullable @Nullable String key, PointCloudViewer pcv)
      Opens a dialog, asks the user where to save the point cloud, then saves the point cloud
    • saveListSe3Dialog

      public static void saveListSe3Dialog(@Nullable @Nullable Component owner, @Nullable @Nullable String key, PointCloudViewer pcv)
      Opens a dialog, asks the user where to save the sequence of Se3
    • saveDisparityDialog

      public static void saveDisparityDialog(@Nullable @Nullable JComponent owner, @Nullable @Nullable String key, 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
    • visualizeCameras

      public static void visualizeCameras(SceneStructureMetric structure, PointCloudViewer viewer)
      Renders camera views as squares from a SceneStructureMetric