Package com.project
Class Main
java.lang.Object
com.project.Main
The entry point for the File Security application.
This class provides a command-line interface for encrypting and
decrypting files. It uses Swing's JFileChooser
for file selection
and handles user interactions with the console.
- Since:
- 2025-03-29
- Version:
- 1.0.0
- Author:
- Anurag Zete
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static File
The file selected by the user for encryption/decryption.private static JFrame
JFrame used for the file chooser dialog.private static boolean
Flag indicating whether encryption or decryption is selected.private static String
The password used for encryption or decryption.private static Scanner
Scanner for reading user input. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
Handles the file operations by allowing the user to choose between encryption, decryption, or exiting the program.static void
The main method that starts the application.
-
Field Details
-
sc
Scanner for reading user input. -
frame
JFrame used for the file chooser dialog. -
password
The password used for encryption or decryption. -
file
The file selected by the user for encryption/decryption. -
isEncryptSelected
private static boolean isEncryptSelectedFlag indicating whether encryption or decryption is selected.
-
-
Constructor Details
-
Main
Main()Constructor initializes the JFrame with the default close operation.
-
-
Method Details
-
main
The main method that starts the application.It displays an ASCII banner, prompts the user to select an operation, and handles the encryption or decryption process.
- Parameters:
args
- Command-line arguments (not used).
-
fileHandler
private static void fileHandler()Handles the file operations by allowing the user to choose between encryption, decryption, or exiting the program.Displays a menu and uses
JFileChooser
for file selection. It repeatedly prompts the user until a valid operation is chosen.
-