From 6d783bcc96f6b5060f697bed28a2661ca26f5067 Mon Sep 17 00:00:00 2001 From: fdai7460 Date: Thu, 9 Feb 2023 19:35:44 +0100 Subject: [PATCH] 3-te Binomische Formel GUI + Ausgabe --- src/main/java/src/TasksFrame.java | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/main/java/src/TasksFrame.java b/src/main/java/src/TasksFrame.java index b272465..9d32072 100644 --- a/src/main/java/src/TasksFrame.java +++ b/src/main/java/src/TasksFrame.java @@ -1016,28 +1016,33 @@ public class TasksFrame extends JFrame { JLabel j2 = new JLabel(); j2.setText("a:"); j2.setVisible(true); - j2.setBounds(10,60,30,20); + j2.setBounds(10,90,30,20); JLabel j3 = new JLabel(); j3.setText("b:"); j3.setVisible(true); - j3.setBounds(10,80,30,20); + j3.setBounds(70,90,30,20); JLabel j4 = new JLabel(); j4.setText("(a - b)" +c2 +" = "); j4.setVisible(true); j4.setBounds(10,40,150,20); + JLabel j5 = new JLabel(); + j5.setText("(a + b)*(a - b)" +" = "); + j5.setVisible(true); + j5.setBounds(10,60,150,20); + JTextField f1 = new JTextField(); f1.setVisible(true); - f1.setBounds(45,60,30,20); + f1.setBounds(30,90,30,20); JTextField f2 = new JTextField(); f2.setVisible(true); - f2.setBounds(45,80,30,20); + f2.setBounds(85,90,30,20); JButton jButton = new JButton(); - jButton.setBounds(10,100,100,30); + jButton.setBounds(10,120,100,30); jButton.setText("Berechne"); jButton.setVisible(true); @@ -1049,6 +1054,10 @@ public class TasksFrame extends JFrame { ausgabe2.setBounds(80,40,30,20); ausgabe2.setVisible(false); + JLabel ausgabe3 = new JLabel(); + ausgabe3.setBounds(120,60,30,20); + ausgabe3.setVisible(false); + jButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -1063,9 +1072,15 @@ public class TasksFrame extends JFrame { Integer res2 = bin2(val_a, val_b); ausgabe2.setText(String.valueOf(res2)); ausgabe2.setVisible(true); + + Integer res3 = bin3(val_a, val_b); + ausgabe3.setText(String.valueOf(res3)); + ausgabe3.setVisible(true); } }); + jPanel.add(ausgabe3); + jPanel.add(j5); jPanel.add(ausgabe2); jPanel.add(j4); jPanel.add(ausgabe);