|
|
@ -79,6 +79,52 @@ public class TasksFrame extends JFrame { |
|
|
|
|
|
|
|
setupQuersumme(); |
|
|
|
|
|
|
|
setupKgV(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void setupKgV() { |
|
|
|
JPanel jPanel = setupPanel("kgV"); |
|
|
|
|
|
|
|
JButton button = new JButton("kgV"); |
|
|
|
button.setVisible(true); |
|
|
|
button.setBounds(10, 65, 100, 30); |
|
|
|
|
|
|
|
JTextField a = new JTextField(); |
|
|
|
a.setBounds(10, 40, 30, 20); |
|
|
|
a.setVisible(true); |
|
|
|
|
|
|
|
JTextField b = new JTextField(); |
|
|
|
b.setBounds(50, 40, 30, 20); |
|
|
|
b.setVisible(true); |
|
|
|
|
|
|
|
JLabel jLabel = new JLabel(); |
|
|
|
jLabel.setVisible(true); |
|
|
|
jLabel.setBounds(10,90,60,30); |
|
|
|
|
|
|
|
jPanel.add(button); |
|
|
|
jPanel.add(a); |
|
|
|
jPanel.add(b); |
|
|
|
jPanel.add(jLabel); |
|
|
|
|
|
|
|
button.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
String texta = a.getText(); |
|
|
|
String textb = b.getText(); |
|
|
|
Integer val_a = Integer.valueOf(texta); |
|
|
|
Integer val_b = Integer.valueOf(textb); |
|
|
|
int res = kgV(val_a, val_b); |
|
|
|
jLabel.setText(String.valueOf(res)); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public int kgV(int a, int b) { |
|
|
|
int kgV= (a*b)/ggt(a,b); |
|
|
|
return kgV; |
|
|
|
} |
|
|
|
|
|
|
|
private void setupQuersumme() { |
|
|
|