|
|
@ -98,6 +98,8 @@ public class TasksFrame extends JFrame { |
|
|
|
setupRoundSum(); |
|
|
|
|
|
|
|
setupExponent(); |
|
|
|
|
|
|
|
setupKreisUmfang(); |
|
|
|
|
|
|
|
setupUmrechnen(); |
|
|
|
|
|
|
@ -108,6 +110,51 @@ public class TasksFrame extends JFrame { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void setupKreisUmfang() { |
|
|
|
|
|
|
|
JPanel jPanel = setupPanel("Kreisumfang"); |
|
|
|
|
|
|
|
JButton button = new JButton("calculate"); |
|
|
|
button.setVisible(true); |
|
|
|
button.setBounds(10, 65, 100, 30); |
|
|
|
button.setBackground(Color.BLUE); |
|
|
|
|
|
|
|
JTextField jTextField = new JTextField(); |
|
|
|
jTextField.setVisible(true); |
|
|
|
jTextField.setBounds( 10, 40, 30, 20); |
|
|
|
jTextField.setFont(new java.awt.Font("Arial", Font.BOLD, 12)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JLabel jLabel = new JLabel(); |
|
|
|
jLabel.setVisible(true); |
|
|
|
jLabel.setBounds(10, 90, 60, 30); |
|
|
|
|
|
|
|
|
|
|
|
jPanel.add(button); |
|
|
|
jPanel.add(jTextField); |
|
|
|
jPanel.add(jLabel); |
|
|
|
|
|
|
|
button.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
String text = jTextField.getText(); |
|
|
|
Double val = Double.valueOf(text); |
|
|
|
double res = Double.valueOf(kreisUmfang(val)); |
|
|
|
jLabel.setText(String.valueOf(res)); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private double kreisUmfang(double radius) { |
|
|
|
|
|
|
|
double result = 2 * Math.PI * radius; |
|
|
|
double roundOff = Math.round(result * 100.0) / 100.0; |
|
|
|
return roundOff; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setupDurchschnitt() { |
|
|
|
|
|
|
|
JPanel jPanel = setupPanel("Durchschnitt"); |
|
|
|