Package View

Class NewBillView

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class NewBillView extends JPanel
A JPanel that provides a user interface for creating a new subscription plan for a utility bill. Users can input the utility type, reading, and date, and then add the new bill or cancel the operation. This view is typically used within a larger application to manage utility bills.

Example usage:

 App myApp = new App();
 NewBillView newBillView = new NewBillView(myApp);
 JFrame frame = new JFrame("New Utility Bill");
 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 frame.getContentPane().add(newBillView);
 frame.pack();
 frame.setVisible(true);
 

See Also:
  • Field Details

    • typeField

      private JComboBox<String> typeField
      JComboBox for selecting the type of utility, such as electricity, gas, or water.
    • readingField

      private JTextField readingField
      JTextField for entering the reading value associated with the utility bill.
    • dateTextField

      private JFormattedTextField dateTextField
      JFormattedTextField for entering the date of the utility bill in the "yyyy-MM-dd" format.
    • addButton

      private JButton addButton
      JButton for adding a new utility bill entry based on the provided data.
    • cancelButton

      private JButton cancelButton
      JButton for canceling the process of adding a new utility bill and returning to the previous view.
  • Constructor Details

    • NewBillView

      public NewBillView(App app)

      NewBillView

      The `NewBillView` class provides a graphical user interface for creating a new utility bill entry. It allows customers to input data for a new utility bill, including the utility type, reading, and date.

      This view consists of components such as labels, input fields, and buttons for user interaction. Users can select the utility type from a dropdown menu, enter the reading, and specify the date. The "Add" button allows users to submit the new bill entry, and the "Cancel" button enables them to return to the customer dashboard.

      Parameters:
      app - The main application instance that controls the view and handles user interactions.
  • Method Details

    • isNumeric

      private boolean isNumeric(String str)
      Checks if a string is numeric.
      Parameters:
      str - The string to check.
      Returns:
      `true` if the string is numeric, `false` otherwise.