Browse Source

Extention of the Button faku in setupFakultaet

remotes/origin/develop
fdai7460 2 years ago
parent
commit
001f915482
  1. 36
      src/main/java/src/TasksFrame.java

36
src/main/java/src/TasksFrame.java

@ -102,8 +102,6 @@ public class TasksFrame extends JFrame {
}
private void setupExponent() {
JPanel jPanel = setupPanel("Potenzrechner");
@ -240,7 +238,6 @@ public class TasksFrame extends JFrame {
return roundOff;
}
private void setupUmrechnen() {
JPanel jPanel = setupPanel("Dezimal nach Binär");
@ -354,7 +351,6 @@ public class TasksFrame extends JFrame {
}
}
private void setupKgV() {
JPanel jPanel = setupPanel("kgV");
@ -444,7 +440,6 @@ public class TasksFrame extends JFrame {
return quersumme;
}
public int calcMod(int n, int x)
{
int rest = n % x;
@ -594,7 +589,6 @@ public class TasksFrame extends JFrame {
}
public int calcSumm(int a, int b) {
return a+b;
}
@ -674,9 +668,14 @@ public class TasksFrame extends JFrame {
{
JPanel jPanel = setupPanel("Berechnen Sie die Fakultaet einer Zahl:");
JLabel text1 = new JLabel();
text1.setText("Zahleingabe:");
text1.setVisible(true);
text1.setBounds(0,25,80,30);
JTextField a = new JTextField();
a.setVisible(true);
a.setBounds(50,25,35,30);
a.setBounds(90,25,35,30);
a.setFont(new java.awt.Font("Arial", Font.BOLD, 12));
JButton faku = new JButton("Calculate Fakultaet");
@ -689,6 +688,18 @@ public class TasksFrame extends JFrame {
res.setBounds(50,100,35,30);
res.setFont(new java.awt.Font("Arial", Font.BOLD, 12));
JLabel text2 = new JLabel();
text2.setText("! = ");
text2.setVisible(true);
text2.setBounds(30,100,40,30);
text2.setFont(new java.awt.Font("Arial", Font.BOLD, 12));
JTextField new2 = new JTextField();
new2.setBounds(0,100,35,30);
new2.setVisible(true);
new2.setFont(new java.awt.Font("Arial", Font.BOLD, 12));
faku.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -696,16 +707,19 @@ public class TasksFrame extends JFrame {
Integer val_a = Integer.valueOf(texta);
Integer res1 = Fakultaet(val_a);
res.setText(String.valueOf(res1));
new2.setText(String.valueOf(val_a));
jPanel.add(res);
jPanel.add(text2);
jPanel.add(new2);
}
});
jPanel.add(a);
jPanel.add(faku);
jPanel.add(res);
jPanel.add(text1);
}
public void setupArea()
{
JPanel jPanel = setupPanel("Area and perimeter of a Rectangle:");
@ -785,8 +799,6 @@ public class TasksFrame extends JFrame {
}
public int calcArea(int a, int b)
{
int area = a * b;
@ -799,7 +811,6 @@ public class TasksFrame extends JFrame {
return perimeter;
}
public void setupSumFromTo(){
JPanel jPanel = setupPanel("Sum from to");
@ -851,7 +862,6 @@ public class TasksFrame extends JFrame {
return sum+to;
}
private ArrayList<Integer> setup5ModList(int from, int to) {
ArrayList<Integer> mods = new ArrayList<>();

Loading…
Cancel
Save