Class Jars.JarDisplay

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Enclosing class:
Jars

private class Jars.JarDisplay extends JPanel
JarDisplay class represents the display of jars in the Jars screen. It contains the jar image, title, value, progress bar, and buttons for each jar. It also handles the actions for copying jar ID, depositing to jars, and withdrawing from jars. It creates a new JPanel for each jar and adds it to itself. The JarDisplay object is created in the Jars constructor and added to a JScrollPane.
  • Field Details

    • currentUser

      User currentUser
      User object representing the current user.
    • gbagLayout

      GridBagLayout gbagLayout
      GridBagLayout object used for layout management.
    • gridBagConstraints

      GridBagConstraints gridBagConstraints
      GridBagConstraints object used for layout management.
    • jarImage

      JLabel jarImage
      JLabel for the jar's image.
    • jarPanel

      JPanel jarPanel
      JPanel for the jar.
    • jarTitle

      JLabel jarTitle
      Label for the jar's title.
    • jarValue

      JLabel jarValue
      Label for the jar's value.
    • jarGoalProgress

      JProgressBar jarGoalProgress
      JProgressBar for the jar's goal.
    • buttonsContainer

      JPanel buttonsContainer
      Container for the buttons.
    • copyBtn

      JButton copyBtn
      Button to copy the jar's ID.
    • depositBtn

      JButton depositBtn
      Button to deposit into the jar.
    • withdrawBtn

      JButton withdrawBtn
      Button to withdraw from the jar.
  • Constructor Details

    • JarDisplay

      JarDisplay()
      Constructs a JarDisplay object.
  • Method Details

    • copyId

      private void copyId(ActionEvent event)
      Handles the action event when the copy ID button is clicked. This method copies the jar ID to the clipboard.
      Parameters:
      event - The action event triggered when the copy ID button is clicked.
    • depositHandler

      private void depositHandler(ActionEvent event)
      Handles the action event when the deposit button is clicked. This method switches the view to the deposit jar screen.
      Parameters:
      event - The action event triggered when the deposit button is clicked.
    • withdrawHandler

      private void withdrawHandler(ActionEvent event)
      Handles the action event when the withdraw button is clicked. This method switches the view to the withdraw from jar screen.
      Parameters:
      event - The action event triggered when the withdraw button is clicked.