From 74962dde7d6138e988e9eb6f023a70057c9af043 Mon Sep 17 00:00:00 2001 From: fdai7460 Date: Thu, 9 Feb 2023 19:09:16 +0100 Subject: [PATCH] Binomische Formel mit Ausgabe --- src/main/java/src/TasksFrame.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/src/TasksFrame.java b/src/main/java/src/TasksFrame.java index b7f3555..18bfa1b 100644 --- a/src/main/java/src/TasksFrame.java +++ b/src/main/java/src/TasksFrame.java @@ -1021,8 +1021,23 @@ public class TasksFrame extends JFrame { jButton.setText("Berechne"); jButton.setVisible(true); + JLabel ausgabe = new JLabel(); + ausgabe.setBounds(80,20,30,20); + ausgabe.setVisible(false); + jButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String texta = f1.getText(); + String textb = f2.getText(); + Integer val_a = Integer.valueOf(texta); + Integer val_b = Integer.valueOf(textb); + Integer res = bin1(val_a, val_b); + ausgabe.setText(String.valueOf(res)); + ausgabe.setVisible(true); + } + }); - + jPanel.add(ausgabe); jPanel.add(jButton); jPanel.add(f1); jPanel.add(f2);