java.lang.Object
com.example.brickpaint.BrickSave
Handles saving a snapshot image of a JavaFX Node with user created or predefined files
- Author:
- matde
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FilechangeExtension(File f, String newExtension) Helper function that will modify the extension of a filestatic FilesaveImageASFromNode(javafx.scene.Node node, String Name, org.apache.logging.log4j.Logger logger) Takes a snapshot of a Node and saves it to a file created by the user.static voidsaveImageFromNode(javafx.scene.Node node, File file, org.apache.logging.log4j.Logger logger, String Name) Takes a snapshot of a Node and saves it to the specified file
-
Field Details
-
savePath
-
-
Constructor Details
-
BrickSave
public BrickSave()
-
-
Method Details
-
saveImageFromNode
public static void saveImageFromNode(javafx.scene.Node node, File file, org.apache.logging.log4j.Logger logger, String Name) Takes a snapshot of a Node and saves it to the specified file- Parameters:
node- The Node from which to take a screenshot offile- The File to save the image toName- The name of the node/file being savedlogger- The logger to log the save operation to
-
saveImageASFromNode
public static File saveImageASFromNode(javafx.scene.Node node, String Name, org.apache.logging.log4j.Logger logger) Takes a snapshot of a Node and saves it to a file created by the user. Will open the file explorer and initially name the file based off the Name- Parameters:
node- The node from which to take a screenshot ofName- Optional path string from which to initially name the new file withlogger- The logger to log the save operation to- Returns:
- returns file that image was saved to, else returns null
-
changeExtension
Helper function that will modify the extension of a file- Parameters:
f- File to ModifynewExtension- The extension the file should be changed to- Returns:
- The renamed file
-