Package com.project

Class Main

java.lang.Object
com.project.Main

public class Main extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    private 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
    Constructor
    Description
    Constructor initializes the JFrame with the default close operation.
  • Method Summary

    Modifier and Type
    Method
    Description
    private static void
    Handles the file operations by allowing the user to choose between encryption, decryption, or exiting the program.
    static void
    main(String[] args)
    The main method that starts the application.

    Methods inherited from class java.lang.Object

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

    • sc

      private static Scanner sc
      Scanner for reading user input.
    • frame

      private static JFrame frame
      JFrame used for the file chooser dialog.
    • password

      private static String password
      The password used for encryption or decryption.
    • file

      private static File file
      The file selected by the user for encryption/decryption.
    • isEncryptSelected

      private static boolean isEncryptSelected
      Flag indicating whether encryption or decryption is selected.
  • Constructor Details

    • Main

      Main()
      Constructor initializes the JFrame with the default close operation.
  • Method Details

    • main

      public static void main(String[] args)
      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.