From c9dd9469183d95c6c2f4d01e3d6365ec57386a65 Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Mon, 25 Apr 2022 18:43:46 +0200 Subject: Initial commit --- src/algorithmus/Palisaden.java | 72 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 src/algorithmus/Palisaden.java (limited to 'src/algorithmus/Palisaden.java') diff --git a/src/algorithmus/Palisaden.java b/src/algorithmus/Palisaden.java new file mode 100755 index 0000000..fa822d4 --- /dev/null +++ b/src/algorithmus/Palisaden.java @@ -0,0 +1,72 @@ +package algorithmus; + +import java.awt.TextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JSpinner; + +public class Palisaden extends Algorithmus { + + private String name; + private int n; + + public Palisaden() { + name = "Palisaden"; + n = 3; + } + + @Override + public void options() { + JFrame frame = new JFrame(); + frame.setLayout(null); + frame.setTitle("Palisaden"); + frame.setSize(200, 150); + JLabel label = new JLabel("Reihen:"); + label.setBounds(5, 30, 100, 20); + JSpinner spinner = new JSpinner(); + spinner.setBounds(100, 30, 50, 20); + spinner.setValue(n); + JButton apply = new JButton("Speichern"); + apply.setBounds(5, 55, 100, 20); + apply.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + n = (int) spinner.getValue(); + } + }); + frame.add(label); + frame.add(spinner); + frame.add(apply); + frame.setVisible(true); + } + + @Override + public String getName() { + return name; + } + + @Override + public String encode(String input) { + String out = ""; + int length = input.length(); + String[] rows = new String[n]; + for(int i = 0; i