Package angry3vilbot.bankingapp
Class Send
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
angry3vilbot.bankingapp.Api
angry3vilbot.bankingapp.Send
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible
Send class is a
If the user clicks the send button, it will call the
JPanel that allows the user to send money to another person's account.
It contains a title, radio buttons for selecting between new and recent entries,
text fields for entering the recipient's name, card number, and amount to send,
and buttons for submitting or canceling the transaction.
If the user clicks the send button, it will call the
Api.send(double, BigDecimal, String) method
with the entered data.
If the user clicks the cancel button, it will revert the fields to their initial values
and switch the card back to the Main panel.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescription(package private) JTextFieldField for the amount to be sent.(package private) JLabelLabel for the amount field.(package private) JButtonButton to cancel the transaction.(package private) JPanelContainer for the combo boxes.(package private) JPanelContainer that wraps the text fields and combo boxes containers to allow switching between the two.(package private) JTextFieldField for the name.ComboBox for the name.(package private) JLabelLabel for the name field.(package private) JLabelLabel for the name combo box.(package private) JButtonButton to switch to entering new payment info.(package private) JPanelContainer for the new/recent buttons.(package private) ButtonGroupButtonGroupfor the new/recent buttons.(package private) JTextFieldField for the card number.ComboBox for the card number.(package private) JLabelLabel for the card number field.(package private) JLabelLabel for the card number combo box.(package private) JButtonButton to switch to using recent entries.List of recent entries read from the file.(package private) JButtonButton to submit the transaction.(package private) JPanelContainer for the text fields.(package private) JLabelLabel for the title of the panel.Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidHandles the cancel button click event.private voidHandles the selection logic of the combo boxes.private voidReads the recent entries from a file and stores them in a list.private voidsavePaymentInfo(List<String> entries) Saves the payment information to a file.private voidHandles the selection of the "New" or "Recent" buttons.private voidHandles the submit button click event.Methods inherited from class angry3vilbot.bankingapp.Api
authenticate, createJar, deleteDepositRequest, deposit, deposit, depositToJar, fulfillDepositRequest, getDepositRequestData, getJarData, getTransactionData, send, signUp, update, withdrawFromJarMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
title
JLabel titleLabel for the title of the panel. -
newRecentGroup
ButtonGroup newRecentGroupButtonGroupfor the new/recent buttons. -
newRecentContainer
JPanel newRecentContainerContainer for the new/recent buttons. -
inputsContainer
JPanel inputsContainerContainer that wraps the text fields and combo boxes containers to allow switching between the two. -
textFieldsContainer
JPanel textFieldsContainerContainer for the text fields. -
comboBoxContainer
JPanel comboBoxContainerContainer for the combo boxes. -
newBtn
JButton newBtnButton to switch to entering new payment info. -
recentBtn
JButton recentBtnButton to switch to using recent entries. -
nameL
JLabel nameLLabel for the name field. -
numberL
JLabel numberLLabel for the card number field. -
amountL
JLabel amountLLabel for the amount field. -
nameLCombo
JLabel nameLComboLabel for the name combo box. -
numberLCombo
JLabel numberLComboLabel for the card number combo box. -
name
JTextField nameField for the name. -
number
JTextField numberField for the card number. -
amount
JTextField amountField for the amount to be sent. -
nameBox
ComboBox for the name. -
numberBox
ComboBox for the card number. -
submitBtn
JButton submitBtnButton to submit the transaction. -
cancelBtn
JButton cancelBtnButton to cancel the transaction. -
recentEntriesList
List of recent entries read from the file.
-
-
Constructor Details
-
Send
Send()Constructs a Send object.
-
-
Method Details
-
selectionHandler
Handles the selection of the "New" or "Recent" buttons. It switches the input fields between text fields and combo boxes.- Parameters:
e- the event that triggered the method
-
comboBoxHandler
Handles the selection logic of the combo boxes. It sets the selected index of the otherJComboBoxto be the same as the one that was used to make the selection.- Parameters:
e- the event that triggered the method
-
readRecentEntries
private void readRecentEntries()Reads the recent entries from a file and stores them in a list. If the file does not exist, it initializes an empty list. This method is called when the class is instantiated.
It reads the entries from the file called "recentTransfers.txt". If the file does not exist, it initializes an empty list. -
savePaymentInfo
Saves the payment information to a file. This method is called when the user clicks the send button. It writes the entries to a file called "recentTransfers.txt". If the file does not exist, it creates a new one.
It takes aListof entries as input and writes each entry to the file. Each entry is written on a new line.- Parameters:
entries- the list of entries to be saved
-
submitBtnHandler
Handles the submit button click event.
Validates the input fields and performs the send operation. If the input is valid, it calls theApi.send(double, BigDecimal, String)method with the entered data.- Parameters:
e- the event that triggered the method
-
cancelBtnHandler
Handles the cancel button click event. Reverts the input fields to their initial values and switches the card back to theMainpanel.- Parameters:
e- the event that triggered the method
-