Package JavaFX

Class Utils


  • public class Utils
    extends java.lang.Object
    Utilities class. It wraps some useful methods that are used by two or more classes.
    Author:
    Leonardo-Rocha
    • Constructor Summary

      Constructors 
      Constructor Description
      Utils()  
    • Method Summary

      Modifier and Type Method Description
      static void addFileToProperties​(java.io.File newFile)
      Add a new file to configuration file.
      static void configCanvasResize​(javafx.stage.Stage primaryStage, javafx.scene.canvas.Canvas canvas)
      Config canvas automatic resize according to root size.
      static void createPropertiesFile​(java.util.Map<java.lang.String,​java.io.File> mapToSave)
      Write the files path to a .properties.
      static java.util.Map<java.lang.String,​java.io.File> readPropertiesFile()
      Read the properties file.
      • Methods inherited from class java.lang.Object

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

      • properties

        private static java.util.Properties properties
      • configFile

        private static java.io.File configFile
      • fileOutputStream

        private static java.io.FileOutputStream fileOutputStream
      • recentFiles

        public static java.util.Map<java.lang.String,​java.io.File> recentFiles
      • lastValidIndex

        private static int lastValidIndex
    • Constructor Detail

      • Utils

        public Utils()
    • Method Detail

      • configCanvasResize

        public static void configCanvasResize​(javafx.stage.Stage primaryStage,
                                              javafx.scene.canvas.Canvas canvas)
        Config canvas automatic resize according to root size.
        Parameters:
        primaryStage - stage reference.
        canvas - reference of the cangas to config automatic resize.
      • createPropertiesFile

        public static void createPropertiesFile​(java.util.Map<java.lang.String,​java.io.File> mapToSave)
        Write the files path to a .properties.
        Parameters:
        mapToSave - map of files to save on the .properties.
      • readPropertiesFile

        public static java.util.Map<java.lang.String,​java.io.File> readPropertiesFile()
        Read the properties file.
        Returns:
        a map containing the name and the path of the files.
      • addFileToProperties

        public static void addFileToProperties​(java.io.File newFile)
                                        throws java.io.IOException
        Add a new file to configuration file.
        Parameters:
        newFile - file reference to be added.
        Throws:
        java.io.IOException - if an error occurs during file writing.