Skip to content
This repository was archived by the owner on Apr 11, 2025. It is now read-only.

Commit a14b975

Browse files
author
codewithJosh
committed
feat: add back and calculator button
1 parent bb38d9b commit a14b975

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/main/java/com/codewithjosh/ExpenseTracker2k19/BudgetScreen.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.toedter.calendar.*;
44
import java.awt.*;
55
import java.awt.event.*;
6+
import java.io.IOException;
67
import java.util.logging.*;
78
import java.util.prefs.Preferences;
89
import javax.swing.*;
@@ -241,6 +242,11 @@ public void mousePressed(MouseEvent evt)
241242

242243
btnBack.setContentAreaFilled(false);
243244
btnBack.setCursor(new Cursor(Cursor.HAND_CURSOR));
245+
btnBack.addActionListener((ActionEvent evt)
246+
->
247+
{
248+
btnBackActionPerformed(evt);
249+
});
244250
DataPanel.add(btnBack, new AbsoluteConstraints(20, 20, -1, -1));
245251

246252
btnAdd.setContentAreaFilled(false);
@@ -253,6 +259,11 @@ public void mousePressed(MouseEvent evt)
253259

254260
btnCalculator.setContentAreaFilled(false);
255261
btnCalculator.setCursor(new Cursor(Cursor.HAND_CURSOR));
262+
btnCalculator.addActionListener((ActionEvent evt)
263+
->
264+
{
265+
btnCalculatorActionPerformed(evt);
266+
});
256267
DataPanel.add(btnCalculator, new AbsoluteConstraints(680, 30, -1, -1));
257268

258269
dcFrom.setDateFormatString("yyyy-MM-dd");
@@ -396,6 +407,32 @@ private void btnModeActionPerformed(ActionEvent evt)
396407

397408
}
398409

410+
private void btnBackActionPerformed(ActionEvent evt)
411+
{
412+
413+
dispose();
414+
new HomeScreen().setVisible(true);
415+
416+
}
417+
418+
private void btnCalculatorActionPerformed(ActionEvent evt)
419+
{
420+
421+
try
422+
{
423+
424+
Runtime.getRuntime().exec("calc");
425+
426+
}
427+
catch (IOException ex)
428+
{
429+
430+
Logger.getLogger(ExpensesScreen.class.getName()).log(Level.SEVERE, null, ex);
431+
432+
}
433+
434+
}
435+
399436
public static void main(String args[])
400437
{
401438

0 commit comments

Comments
 (0)