From 9640cf079a13cdd5fd2dbd8da975c2f25176a0a0 Mon Sep 17 00:00:00 2001 From: fdai7460 Date: Mon, 6 Feb 2023 21:17:27 +0100 Subject: [PATCH] Steuer Berechner mit Ausgabe von 7% und 19% --- src/main/java/src/TasksFrame.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/src/TasksFrame.java b/src/main/java/src/TasksFrame.java index 215454e..4dc79ed 100644 --- a/src/main/java/src/TasksFrame.java +++ b/src/main/java/src/TasksFrame.java @@ -284,6 +284,11 @@ public class TasksFrame extends JFrame { s19.setBounds(180,60,50,30); s19.setText("19%"); + JButton s07 = new JButton(); + s07.setVisible(true); + s07.setBounds(240,60,50,30); + s07.setText("7%"); + JLabel ausgabe = new JLabel(); ausgabe.setVisible(true); ausgabe.setBounds(10,90,300,30); @@ -299,9 +304,21 @@ public class TasksFrame extends JFrame { } }); + s07.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String textPreis = preis.getText(); + double val_preis = Double.valueOf(textPreis); + double res = steuer7(val_preis); + ausgabe.setText("Die Steuer beträgt:" +res +"€"); + + } + }); + jPanel.add(ausgabe); jPanel.add(euro); jPanel.add(s19); + jPanel.add(s07); jPanel.add(frage); jPanel.add(preis); jPanel.add(info);