- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathframe.java
More file actions
Latest commit
61 lines (49 loc) · 2.04 KB
/
Copy pathframe.java
File metadata and controls
61 lines (49 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
packagecom.mycompany.bdowithdrawal;
importjavax.swing.*;
classframe {
// Date of Withdrawal
publicintdate = 7;
publicintmonth = 10;
publicintyear = 24;
// Additional Info
publicStringlocation = "SMCITYLIPA";
publicintterminalId = 102084;
publiclongcardNo = 1234567891234567L;
publicStringappLabel = "BDO VISA DEBIT";
// Balances
publicdoublecurrentBal = 3500.00;
publicdoublepreviousBal = 3500.00;
publicStringreciept;
publicframe() {
updateReceipt(); // Initialize receipt
}
publicvoidupdateReceipt() {
reciept = """
------------------------------------------------------------------------
BDO TRANSACTION RECORD
Date: """ + date + " " + month + " " + year + "\n" +
"Location: " + location + "\n" +
"Terminal ID: " + terminalId + "\n" +
"Card NO. " + cardNo + "\n" +
"Application Label: " + appLabel + "\n" + "\n" +
"Previous Balance: " + previousBal + "\n" +
"Current Balance: " + currentBal + "\n" +
"------------------------------------------------------------------------";
}
publicvoidFrame() {
JFramef = newJFrame();
//frame size
f.setSize(350,400);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Text area
JTextAreatextArea = newJTextArea();
textArea.setText(reciept);
textArea.setEditable(false); // Make it read-only
textArea.setLineWrap(true); // Enable line wrapping
textArea.setWrapStyleWord(true); // Wrap at word boundaries
// Wrap the JTextArea in a JScrollPane
JScrollPanescrollPane = newJScrollPane(textArea);
f.add(scrollPane); // Add the scroll pane to the frame
f.setVisible(true);
}
}