|
|
@ -69,6 +69,8 @@ public class TasksFrame extends JFrame { |
|
|
|
|
|
|
|
setupDate(); |
|
|
|
|
|
|
|
setupTemperatur(); |
|
|
|
|
|
|
|
setupSum(); |
|
|
|
|
|
|
|
setupDiff(); |
|
|
@ -723,9 +725,59 @@ public class TasksFrame extends JFrame { |
|
|
|
public double temperatur(double tem){ |
|
|
|
double x=0; |
|
|
|
x = tem + 273.15; |
|
|
|
x = Math.round(x * 100.0) / 100.0; |
|
|
|
return x; |
|
|
|
} |
|
|
|
|
|
|
|
private void setupTemperatur() |
|
|
|
{ |
|
|
|
JPanel jPanel = setupPanel("Temperatur Rechner"); |
|
|
|
|
|
|
|
JTextField a = new JTextField(); |
|
|
|
a.setVisible(true); |
|
|
|
a.setBounds(10,30,35,30); |
|
|
|
a.setFont(new java.awt.Font("Arial", Font.BOLD, 12)); |
|
|
|
|
|
|
|
JLabel jLabel = new JLabel(); |
|
|
|
jLabel.setBounds(45,35,20,20); |
|
|
|
jLabel.setText("°C"); |
|
|
|
jLabel.setVisible(true); |
|
|
|
jLabel.setFont(new java.awt.Font("Arial", Font.BOLD, 12)); |
|
|
|
|
|
|
|
JButton jButton = new JButton(); |
|
|
|
jButton.setText("Umwandle zum Kelvin"); |
|
|
|
jButton.setBounds(10,60,200,30); |
|
|
|
jButton.setVisible(true); |
|
|
|
jButton.setFont(new java.awt.Font("Arial", Font.BOLD, 12)); |
|
|
|
|
|
|
|
JTextField result = new JTextField(); |
|
|
|
result.setBounds(10, 100, 60, 20); |
|
|
|
result.setVisible(true); |
|
|
|
result.setFont(new java.awt.Font("Arial", Font.BOLD, 12)); |
|
|
|
|
|
|
|
JLabel k = new JLabel(); |
|
|
|
k.setBounds(70,100,20,20); |
|
|
|
k.setText("K"); |
|
|
|
k.setFont(new java.awt.Font("Arial", Font.BOLD, 12)); |
|
|
|
|
|
|
|
jButton.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
String texta = a.getText(); |
|
|
|
double val_a = Double.valueOf(texta); |
|
|
|
double res = temperatur(val_a); |
|
|
|
result.setText(String.valueOf(res)); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
jPanel.add(a); |
|
|
|
jPanel.add(jLabel); |
|
|
|
jPanel.add(result); |
|
|
|
jPanel.add(jButton); |
|
|
|
jPanel.add(k); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setupArea() |
|
|
|
{ |
|
|
|
JPanel jPanel = setupPanel("Area and perimeter of a Rectangle:"); |
|
|
|