|
|
@ -69,6 +69,10 @@ public class TasksFrame extends JFrame { |
|
|
|
setup5ModList(1, 20); |
|
|
|
|
|
|
|
setupLeibnizR(1000); |
|
|
|
|
|
|
|
setupDiff(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -129,6 +133,48 @@ public class TasksFrame extends JFrame { |
|
|
|
jPanel.add(jLabel); |
|
|
|
} |
|
|
|
|
|
|
|
public void setupDiff(){ |
|
|
|
JPanel jPanel = setupPanel("Difference"); |
|
|
|
|
|
|
|
JTextField x = new JTextField(); |
|
|
|
x.setBounds(10,50,30,20); |
|
|
|
x.setVisible(true); |
|
|
|
|
|
|
|
JTextField y = new JTextField(); |
|
|
|
y.setBounds(50,50,30,20); |
|
|
|
y.setVisible(true); |
|
|
|
|
|
|
|
JTextField result = new JTextField(); |
|
|
|
result.setBounds(100,50,30,20); |
|
|
|
result.setVisible(true); |
|
|
|
|
|
|
|
JButton difference = new JButton("Difference"); |
|
|
|
difference.setBounds(10,90,100,30); |
|
|
|
difference.setVisible(true); |
|
|
|
|
|
|
|
difference.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
String textx = x.getText(); |
|
|
|
String texty = y.getText(); |
|
|
|
Integer val_x = Integer.valueOf(textx); |
|
|
|
Integer val_y = Integer.valueOf(texty); |
|
|
|
Integer res = calcDiff(val_x, val_y); |
|
|
|
result.setText(String.valueOf(res)); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
jPanel.add(x); |
|
|
|
jPanel.add(y); |
|
|
|
jPanel.add(result); |
|
|
|
jPanel.add(difference); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public int calcDiff(int a, int b) { |
|
|
|
return a-b; |
|
|
|
} |
|
|
|
|
|
|
|
private void setupSum() { |
|
|
|
JPanel jPanel = setupPanel("Summe"); |
|
|
|
|
|
|
|