java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
cmpt213.assignment4.packagedeliveries.client.view.util.customUI.AddPackageDialog
All Implemented Interfaces:
com.github.lgooddatepicker.optionalusertools.DateTimeChangeListener, ActionListener, FocusListener, ItemListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class AddPackageDialog extends JDialog implements ActionListener, ItemListener, com.github.lgooddatepicker.optionalusertools.DateTimeChangeListener, FocusListener
Custom dialog that shows up when a package is being added to the system. Should not be stored as a Singleton class object, needs to be run as a new object each time. Inherits from JDialog
See Also:
  • Field Details

  • Constructor Details

    • AddPackageDialog

      public AddPackageDialog(Frame parent, String title, String btnYesText, String btnNoText, PackageDeliveryControl control)
      Constructor for Add Package dialog, sets up look and feel of dialog
      Parameters:
      parent - Frame for exitConfirm dialog
      title - Title of Dialog Frame
      btnYesText - Text of Affirmative button
      btnNoText - Text of Exit button
      control - Control class instance
  • Method Details

    • run

      public final void run()
      Invokes this dialog without needing a Runnable object.
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Handles what happens when a package is to be created or creation process is cancelled. Shows exit confirm dialog if Cancel button is pressed.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      e - the event to be processed
    • itemStateChanged

      public void itemStateChanged(ItemEvent e)
      Changes UI depending on which item is pressed in the combo box.
      Specified by:
      itemStateChanged in interface ItemListener
      Parameters:
      e - the event to be processed
    • dateOrTimeChanged

      public void dateOrTimeChanged(com.github.lgooddatepicker.zinternaltools.DateTimeChangeEvent dateTimeChangeEvent)
      Handles what happens when a date is selected on UI.
      Specified by:
      dateOrTimeChanged in interface com.github.lgooddatepicker.optionalusertools.DateTimeChangeListener
      Parameters:
      dateTimeChangeEvent - Event tells method what happened to DateTimePicker
    • focusGained

      public void focusGained(FocusEvent e)
      Method handles what happens when a TextArea is focused.
      Specified by:
      focusGained in interface FocusListener
      Parameters:
      e - the event to be processed
    • focusLost

      public void focusLost(FocusEvent e)
      Method handles what happens when a TextArea is not focused. Checks validity of textAreas.
      Specified by:
      focusLost in interface FocusListener
      Parameters:
      e - the event to be processed
    • paint

      public void paint(Graphics g)
      Paints a brown line separator on screen.
      Overrides:
      paint in class Window
      Parameters:
      g - the specified Graphics window