Package boofcv.gui
Class BoofSwingUtil
java.lang.Object
boofcv.gui.BoofSwingUtil
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static class
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addToRecentFiles
(Component parent, String name, List<String> filePaths) static void
addToRecentFiles
(String preferenceName, String name, List<String> filePaths) static Graphics2D
Convenience function which sets rendering hints that the improve rendering quality of 2D graphics and will return the type casted Graphics2D.static JButton
button
(String name, @Nullable ActionListener action) static JCheckBox
checkbox
(String name, boolean checked, @Nullable ActionListener action) static void
static void
static JButton
createButtonIcon
(String path, int width, int height, boolean opaque) static JButton
createButtonIconGUI
(String path, int width, int height) static JFormattedTextField
createHexTextField
(long current) static JMenuItem
createMenuItem
(String name, int mnmonic, int accelerator, BoofLambdas.ProcessCall action) static JMenuItem
createMenuItem
(String name, BoofLambdas.ProcessCall action) static JFormattedTextField
createTextField
(double current, double min, double max) static JFormattedTextField
createTextField
(int current, int min, int max) static File
static File
ensureSuffix
(File f, String suffix) static @Nullable File
fileChooser
(@Nullable String preferenceName, @Nullable Component parent, boolean openFile, String defaultPath, BoofLambdas.MassageString massageName, BoofSwingUtil.FileTypes... filters) Opens a file chooser for the specified file types.static @Nullable File
fileChooserPreview
(@Nullable String preferenceName, @Nullable Component parent, boolean openFile, String defaultPath, BoofSwingUtil.FileTypes... filters) File chooser with a preview.static String
getDefaultPath
(@Nullable Object parent, @Nullable String key) static List<BoofSwingUtil.RecentFiles>
getListOfRecentFiles
(Component parent) static List<BoofSwingUtil.RecentFiles>
getListOfRecentFiles
(String preferenceName) static JPanel
static JPanel
static void
Standard initialization of Swing for applicationsstatic void
static boolean
static boolean
static double
mouseWheelImageZoom
(double scale, MouseWheelEvent e) static @Nullable File
openFileChooser
(@Nullable Component parent, BoofSwingUtil.FileTypes... filters) static @Nullable File
openFileChooser
(@Nullable Component parent, String defaultPath, BoofSwingUtil.FileTypes... filters) static @Nullable File
openFileChooser
(@Nullable String preferenceName, BoofSwingUtil.FileTypes... filters) Opens a file choose when there is no parent component.static @Nullable File
openFilePreview
(@Nullable Component parent, BoofSwingUtil.FileTypes... filters) static @Nullable File
openFilePreview
(@Nullable String preferenceName, BoofSwingUtil.FileTypes... filters) static @Nullable String[]
openImageSetChooser
(@Nullable Window parent, OpenImageSetDialog.Mode mode, int numberOfImages) openStereoChooser
(Window parent, @Nullable Class<?> owner, boolean isSequence, boolean justImages) static void
recursiveEnable
(JComponent panel, Boolean isEnabled) static void
saveDefaultPath
(@Nullable Object parent, @Nullable String key, File file) static void
saveDisparityDialog
(@Nullable JComponent owner, @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 PNGstatic @Nullable File
saveFileChooser
(Component parent, BoofSwingUtil.FileTypes... filters) static void
saveListSe3Dialog
(@Nullable Component owner, @Nullable String key, PointCloudViewer pcv) Opens a dialog, asks the user where to save the sequence of Se3static void
savePointCloudDialog
(@Nullable Component owner, @Nullable String key, PointCloudViewer pcv) Opens a dialog, asks the user where to save the point cloud, then saves the point cloudstatic void
saveRecentFiles
(String preferenceName, List<BoofSwingUtil.RecentFiles> files) static double
selectZoomToFitInDisplay
(int width, int height) Figures out what the scale should be to fit the window inside the default displaystatic double
selectZoomToShowAll
(JComponent panel, int width, int height) Select a zoom which will allow the entire image to be shown in the panelstatic void
setMenuItemKeys
(JMenuItem menu, int mnemonic, int accelerator) static void
static void
updateRecentItems
(JComponent owner, @Nullable JMenu menuRecent, BoofLambdas.ProcessObject<BoofSwingUtil.RecentFiles> function) static void
visualizeCameras
(SceneStructureMetric structure, PointCloudViewer viewer) Renders camera views as squares from aSceneStructureMetric
static void
warningDialog
(Component component, Exception e) static JComponent
wrapBorder
(JComponent comp) Wraps the component in the center of a BorderLayout
-
Field Details
-
KEY_RECENT_FILES
- See Also:
-
KEY_PREVIOUS_SELECTION
- See Also:
-
KEY_PREVIOUS_DIRECTORY
- See Also:
-
MIN_ZOOM
public static final double MIN_ZOOM- See Also:
-
MAX_ZOOM
public static final double MAX_ZOOM- See Also:
-
-
Constructor Details
-
BoofSwingUtil
public BoofSwingUtil()
-
-
Method Details
-
initializeSwing
public static void initializeSwing()Standard initialization of Swing for applications -
setVerboseWithDemoSettings
-
isRightClick
-
isMiddleMouseButton
-
mouseWheelImageZoom
-
recursiveEnable
-
ensureSuffix
-
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
-
saveDefaultPath
-
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
-
getListOfRecentFiles
-
addToRecentFiles
-
addToRecentFiles
-
saveRecentFiles
-
updateRecentItems
public static void updateRecentItems(JComponent owner, @Nullable @Nullable JMenu menuRecent, BoofLambdas.ProcessObject<BoofSwingUtil.RecentFiles> function) -
invokeNowOrLater
-
checkGuiThread
public static void checkGuiThread() -
checkNotGuiThread
public static void checkNotGuiThread() -
selectZoomToShowAll
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
-
gridPanel
-
createTextField
-
createTextField
-
createHexTextField
-
wrapBorder
Wraps the component in the center of a BorderLayout -
createMenuItem
public static JMenuItem createMenuItem(String name, int mnmonic, int accelerator, BoofLambdas.ProcessCall action) -
createMenuItem
-
setMenuItemKeys
-
warningDialog
-
antialiasing
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
-
createButtonIcon
-
button
-
checkbox
public static JCheckBox checkbox(String name, boolean checked, @Nullable @Nullable ActionListener action) -
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
Renders camera views as squares from aSceneStructureMetric
-