Class BaseUI

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class BaseUI extends JFrame
The BaseUI class represents the main graphical user interface for a simple calculator application.

It sets up the main frame, display panels, and handles theme selection (dark/light mode). It uses the FlatLaf library for a modern UI look and feel.

The class creates and initializes the base layout, display area, and integrates the MainUI component, which contains the calculator buttons and functionalities.

Version:
1.0.0
Author:
Anurag Zete
See Also:
  • Field Details

    • HEIGHT

      protected final int HEIGHT
      The height of the application window.
      See Also:
    • WIDTH

      protected final int WIDTH
      The width of the application window.
      See Also:
    • PRIMARY_DARK_COLOR

      protected final Color PRIMARY_DARK_COLOR
      The primary color used for the dark mode background.
    • SECONDARY_DARK_COLOR

      protected final Color SECONDARY_DARK_COLOR
      The secondary color used for the dark mode panel background.
    • PRIMARY_LIGHT_COLOR

      protected final Color PRIMARY_LIGHT_COLOR
      The primary color used for the light mode background.
    • SECONDARY_LIGHT_COLOR

      protected final Color SECONDARY_LIGHT_COLOR
      The secondary color used for the light mode panel background.
    • isDarkMode

      protected static final boolean isDarkMode
      Flag to determine whether the application should use dark mode or light mode.

      If true, the dark mode theme is applied. Otherwise, light mode is used.

      See Also:
    • displayHolder

      protected JPanel displayHolder
      The main panel that holds the display and history labels.
    • history

      protected JLabel history
      Label to display the calculation history.
    • display

      protected JLabel display
      Label to display the current input or result of the calculator.
  • Constructor Details

    • BaseUI

      BaseUI()
      Constructor for the BaseUI class.

      Initializes the main frame, sets the title, icon, and configures the layout.

      It:

      • Loads the main UI components by creating an instance of MainUI.
      • Registers key listeners for keyboard events.
      • Sets the frame properties such as size, location, and visibility.
  • Method Details

    • main

      public static void main(String[] args)
      The main entry point of the application.

      It applies the selected theme (dark or light mode) using FlatLaf for UI consistency.

      Parameters:
      args - Command-line arguments (not used).