Interpreter-Fehler java.lang.NullPointerException

levinw98

Mitglied
Ich habe ein letztes Problem mit meinem Projekt:

Hier ist mein Java Code:
Java:
public class codieren1 {

static String momstr;
	private static String strtexteingabe;
	static String code1;
	private static String z1;
	private static String z2;
	private static String z3;
	private static String z4;
	private static String z5;
	private static String z6;
	private static String z7;
	private static String z8;
	private static String z9;
	private static String z10;
	private static String z11;
	private static String z12;
	private static String z13;
	private static String z14;
	private static String z15;
	private static String z16;
	private static String z17;
	private static String z18;
	private static String z19;
	private static String z20;
	private static String z21;
	private static String z22;
	private static String z23;
	private static String z24;
	private static String z25;
	private static double l1;
	private static double zpt;
	private static int z;
	public static String textuebergabe = "";
	private static int x = 0;
	private static int y = 1;
	private static int spaces;

	public static void main(String[] args) {

		new codieren1();

	}

	public codieren1() {

		super();

		code1();

		new codieren2();

	}

	private static void code1() {

		strtexteingabe = codeframe.strtext;
		code1 = codeframe.strcode1;

		code1 = code1.replaceAll("Ä", "ae");
		code1 = code1.replaceAll("ä", "ae");
		code1 = code1.replaceAll("Ö", "oe");
		code1 = code1.replaceAll("ö", "oe");
		code1 = code1.replaceAll("Ü", "ue");
		code1 = code1.replaceAll("ü", "ue");
		code1 = code1.replaceAll("ß", "ss");

		l1 = code1.length();

		zpt = strtexteingabe.length() / l1;

		if (zpt - (int) zpt == 0) {

		} else {

			spaces = code1.length() - strtexteingabe.length()
					% code1.length();

			for (int i = 0; i < spaces; i++) {
				strtexteingabe += " ";
			}
		}

		switch ((int) zpt) {
		case 25:
			z25 = strtexteingabe.substring(24 * (int) l1, 25 * (int) l1);
		case 24:
			z24 = strtexteingabe.substring(23 * (int) l1, 24 * (int) l1);
		case 23:
			z23 = strtexteingabe.substring(22 * (int) l1, 23 * (int) l1);
		case 22:
			z22 = strtexteingabe.substring(21 * (int) l1, 22 * (int) l1);
		case 21:
			z21 = strtexteingabe.substring(20 * (int) l1, 21 * (int) l1);
		case 20:
			z20 = strtexteingabe.substring(19 * (int) l1, 20 * (int) l1);
		case 19:
			z19 = strtexteingabe.substring(18 * (int) l1, 19 * (int) l1);
		case 18:
			z18 = strtexteingabe.substring(17 * (int) l1, 18 * (int) l1);
		case 17:
			z17 = strtexteingabe.substring(16 * (int) l1, 17 * (int) l1);
		case 16:
			z16 = strtexteingabe.substring(15 * (int) l1, 16 * (int) l1);
		case 15:
			z15 = strtexteingabe.substring(14 * (int) l1, 15 * (int) l1);
		case 14:
			z14 = strtexteingabe.substring(13 * (int) l1, 14 * (int) l1);
		case 13:
			z13 = strtexteingabe.substring(12 * (int) l1, 13 * (int) l1);
		case 12:
			z12 = strtexteingabe.substring(11 * (int) l1, 12 * (int) l1);
		case 11:
			z11 = strtexteingabe.substring(10 * (int) l1, 11 * (int) l1);
		case 10:
			z10 = strtexteingabe.substring(9 * (int) l1, 10 * (int) l1);
		case 9:
			z9 = strtexteingabe.substring(8 * (int) l1, 9 * (int) l1);
		case 8:
			z8 = strtexteingabe.substring(7 * (int) l1, 8 * (int) l1);
		case 7:
			z7 = strtexteingabe.substring(6 * (int) l1, 7 * (int) l1);
		case 6:
			z6 = strtexteingabe.substring(5 * (int) l1, 6 * (int) l1);
		case 5:
			z5 = strtexteingabe.substring(4 * (int) l1, 5 * (int) l1);
		case 4:
			z4 = strtexteingabe.substring(3 * (int) l1, 4 * (int) l1);
		case 3:
			z3 = strtexteingabe.substring(2 * (int) l1, 3 * (int) l1);
		case 2:
			z2 = strtexteingabe.substring(((int) l1), 2 * (int) l1);
		case 1:
			z1 = strtexteingabe.substring(0, (int) l1);
			break;
		default:
			Object[] options = { "OK" };
			JOptionPane.showOptionDialog(null, "Fehler!", "Achtung",
					JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE,
					null, options, options[0]);
		}

		code1 = code1.replaceAll("A", "a");
		code1 = code1.replaceAll("B", "b");
		code1 = code1.replaceAll("C", "c");
		code1 = code1.replaceAll("D", "d");
		code1 = code1.replaceAll("E", "e");
		code1 = code1.replaceAll("F", "f");
		code1 = code1.replaceAll("G", "g");
		code1 = code1.replaceAll("H", "h");
		code1 = code1.replaceAll("I", "i");
		code1 = code1.replaceAll("J", "j");
		code1 = code1.replaceAll("K", "k");
		code1 = code1.replaceAll("L", "l");
		code1 = code1.replaceAll("M", "m");
		code1 = code1.replaceAll("A", "n");
		code1 = code1.replaceAll("O", "o");
		code1 = code1.replaceAll("P", "p");
		code1 = code1.replaceAll("Q", "q");
		code1 = code1.replaceAll("R", "r");
		code1 = code1.replaceAll("S", "s");
		code1 = code1.replaceAll("T", "t");
		code1 = code1.replaceAll("U", "u");
		code1 = code1.replaceAll("V", "v");
		code1 = code1.replaceAll("W", "w");
		code1 = code1.replaceAll("X", "x");
		code1 = code1.replaceAll("Y", "y");
		code1 = code1.replaceAll("Z", "z");

		z = (int) (strtexteingabe.length() / l1);

		String first = code1;
		String second = momstr;

		switch (z) {
		case 25:
			momstr = z25;
			OrderablePair<String> ordered24 = orderCharactersAfterFirstString(
					first, second);
			z25 = ordered24.b;
		case 24:
			momstr = z24;
			OrderablePair<String> ordered23 = orderCharactersAfterFirstString(
					first, second);
			z24 = ordered23.b;
		case 23:
			momstr = z23;
			OrderablePair<String> ordered22 = orderCharactersAfterFirstString(
					first, second);
			z23 = ordered22.b;
		case 22:
			momstr = z22;
			OrderablePair<String> ordered21 = orderCharactersAfterFirstString(
					first, second);
			z22 = ordered21.b;
		case 21:
			momstr = z21;
			OrderablePair<String> ordered20 = orderCharactersAfterFirstString(
					first, second);
			z21 = ordered20.b;
		case 20:
			momstr = z20;
			OrderablePair<String> ordered19 = orderCharactersAfterFirstString(
					first, second);
			z20 = ordered19.b;
		case 19:
			momstr = z19;
			OrderablePair<String> ordered18 = orderCharactersAfterFirstString(
					first, second);
			z19 = ordered18.b;
		case 18:
			momstr = z18;
			OrderablePair<String> ordered17 = orderCharactersAfterFirstString(
					first, second);
			z18 = ordered17.b;
		case 17:
			momstr = z17;
			OrderablePair<String> ordered16 = orderCharactersAfterFirstString(
					first, second);
			z17 = ordered16.b;
		case 16:
			momstr = z16;
			OrderablePair<String> ordered15 = orderCharactersAfterFirstString(
					first, second);
			z16 = ordered15.b;
		case 15:
			momstr = z15;
			OrderablePair<String> ordered14 = orderCharactersAfterFirstString(
					first, second);
			z15 = ordered14.b;
		case 14:
			momstr = z14;
			OrderablePair<String> ordered13 = orderCharactersAfterFirstString(
					first, second);
			z14 = ordered13.b;
		case 13:
			momstr = z13;
			OrderablePair<String> ordered12 = orderCharactersAfterFirstString(
					first, second);
			z13 = ordered12.b;
		case 12:
			momstr = z12;
			OrderablePair<String> ordered11 = orderCharactersAfterFirstString(
					first, second);
			z12 = ordered11.b;
		case 11:
			momstr = z11;
			OrderablePair<String> ordered10 = orderCharactersAfterFirstString(
					first, second);
			z11 = ordered10.b;
		case 10:
			momstr = z10;
			OrderablePair<String> ordered9 = orderCharactersAfterFirstString(
					first, second);
			z10 = ordered9.b;
		case 9:
			momstr = z9;
			OrderablePair<String> ordered8 = orderCharactersAfterFirstString(
					first, second);
			z9 = ordered8.b;
		case 8:
			momstr = z8;
			OrderablePair<String> ordered7 = orderCharactersAfterFirstString(
					first, second);
			z8 = ordered7.b;
		case 7:
			momstr = z7;
			OrderablePair<String> ordered6 = orderCharactersAfterFirstString(
					first, second);
			z7 = ordered6.b;
		case 6:
			momstr = z6;
			OrderablePair<String> ordered5 = orderCharactersAfterFirstString(
					first, second);
			z6 = ordered5.b;
		case 5:
			momstr = z5;
			OrderablePair<String> ordered4 = orderCharactersAfterFirstString(
					first, second);
			z5 = ordered4.b;
		case 4:
			momstr = z4;
			OrderablePair<String> ordered3 = orderCharactersAfterFirstString(
					first, second);
			z4 = ordered3.b;
		case 3:
			momstr = z3;
			OrderablePair<String> ordered2 = orderCharactersAfterFirstString(
					first, second);
			z3 = ordered2.b;
		case 2:
			momstr = z2;
			OrderablePair<String> ordered1 = orderCharactersAfterFirstString(
					first, second);
			z2 = ordered1.b;
		case 1:
			momstr = z1;
			OrderablePair<String> ordered = orderCharactersAfterFirstString(
					first, second);
			z1 = ordered.b;
			break;
		}

	public static OrderablePair<String> orderCharactersAfterFirstString(
			String a, String b) {
		if (a.length() != b.length()) {
			throw new InputMismatchException(
					"Strings have to be in same length!");
		}
		List<OrderablePair<Character>> list = new ArrayList<>();
		for (int i = 0; i < a.length(); i++) {
			list.add(new OrderablePair<Character>(a.charAt(i), b.charAt(i)));
		}
		Collections.sort(list);

		StringBuilder outFirst = new StringBuilder("");
		StringBuilder outSecond = new StringBuilder("");

		for (OrderablePair<Character> op : list) {
			outFirst.append(op.a);
			outSecond.append(op.b);
		}
		return new OrderablePair<String>(outFirst.toString(),
				outSecond.toString());

	}

	static class OrderablePair<T extends Comparable<T>> implements
			Comparable<OrderablePair<T>> {

		final T a;
		final T b;

		public OrderablePair(T a, T b) {
			this.a = a;
			this.b = b;
		}

		@Override
		public int compareTo(OrderablePair<T> oth) {
			return a.compareTo(oth.a);
		}
	}

}

ich weiß dass manches teilweise sehr umständlich ist. Aber jetzt zu meinem Problem:
wenn ich einen Text wähle, der eigentlich mit Leerzeichen aufgefüllt werden sollte, d.h. ein Text (streingabe) der nicht ohne rest durch den code (code1) geteilt werden kann, dann bekomme ich eine java.lang.NullPointerException in Zeile 306. Ich habe null Ahnung wo der Fehler liegt. :(
 
Zuletzt bearbeitet:

levinw98

Mitglied
Hier die anderen Klassen:
Java:
public class codeframe extends JFrame implements ActionListener {

	private JLabel lbltext;
	private JLabel lblcode1;
	private JLabel lblcode2;
	private JLabel lblinfo;
	private JLabel lblcodeinfo1;
	private JLabel lblcodeinfo2;
	private JLabel lbltextinfo;
	private JTextField txttext;
	private JTextField txtcode1;
	private JTextField txtcode2;
	public static String strtext;
	public static String strcode1;
	public static String strcode2;
	public static String testtext;
	public static String testcode1;
	public static String testcode2;
	private JPanel mainpanel;
	private JPanel panel1;
	private JPanel panel2;
	private JPanel panel3;
	private JPanel btnpanel;
	private JPanel txtpanel;
	private JPanel c1panel;
	private JPanel c2panel;
	private JPanel infopanel;
	private JButton ready;
	private JButton cancel;
	private JButton loeschen;

	public codeframe() {

		super();

		getContentPane().setLayout(new BorderLayout());

		mainpanel = new JPanel();
		mainpanel.setLayout(new BoxLayout(mainpanel, BoxLayout.Y_AXIS));

		lbltext = new JLabel("Zu verschlüsselnder Text:");
		lblcode1 = new JLabel("Erstes Schlüsselwort: ");
		lblcode2 = new JLabel("Zweites Schlüsselwort: ");
		lblinfo = new JLabel(
				"In allen Wörtern müssen ä, ö und ü durch ae, oe und ue ersetzt werden!");
		lblcodeinfo1 = new JLabel("(Min. 4, Max. 20 Buchstaben)");
		lblcodeinfo1.setFont(new Font("Arial", Font.PLAIN, 10));
		lblcodeinfo2 = new JLabel("(Min. 4, Max. 20 Buchstaben)");
		lblcodeinfo2.setFont(new Font("Arial", Font.PLAIN, 10));
		lbltextinfo = new JLabel("(Max. 100 Buchstaben)");
		lbltextinfo.setFont(new Font("Arial", Font.PLAIN, 10));

		txttext = new JTextField();
		txttext.addKeyListener(new AL());
		txtcode1 = new JTextField(
				"Entspircht dem zweiten Schlüsselwort vom Entschlüsseln!");
		txtcode1.addKeyListener(new AL());
		txtcode2 = new JTextField(
				"Entspircht dem ersten Schlüsselwort vom Entschlüsseln!");
		txtcode2.addKeyListener(new AL());

		txtpanel = new JPanel();
		txtpanel.setLayout(new BoxLayout(txtpanel, BoxLayout.X_AXIS));

		txtpanel.add(lbltext);
		txtpanel.add(Box.createRigidArea(new Dimension(5, 0)));
		txtpanel.add(lbltextinfo);

		mainpanel.add(txtpanel);

		panel1 = new JPanel();
		panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS));

		panel1.add(Box.createRigidArea(new Dimension(0, 5)));
		panel1.add(txttext);
		panel1.add(Box.createRigidArea(new Dimension(0, 5)));

		mainpanel.add(panel1);

		c1panel = new JPanel();
		c1panel.setLayout(new BoxLayout(c1panel, BoxLayout.X_AXIS));

		c1panel.add(lblcode1);
		c1panel.add(Box.createRigidArea(new Dimension(5, 0)));
		c1panel.add(lblcodeinfo1);

		mainpanel.add(c1panel);

		panel2 = new JPanel();
		panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));

		panel2.add(Box.createRigidArea(new Dimension(0, 5)));
		panel2.add(txtcode1);
		panel2.add(Box.createRigidArea(new Dimension(0, 5)));

		mainpanel.add(panel2);

		c2panel = new JPanel();
		c2panel.setLayout(new BoxLayout(c2panel, BoxLayout.X_AXIS));

		c2panel.add(lblcode2);
		c2panel.add(Box.createRigidArea(new Dimension(0, 5)));
		c2panel.add(lblcodeinfo2);

		mainpanel.add(c2panel);

		panel3 = new JPanel();
		panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS));

		panel3.add(Box.createRigidArea(new Dimension(0, 5)));
		panel3.add(txtcode2);

		mainpanel.add(panel3);

		btnpanel = new JPanel();

		btnpanel.setLayout(new BoxLayout(btnpanel, BoxLayout.LINE_AXIS));
		btnpanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));

		ready = new JButton("Fertig");
		ready.addActionListener(this);

		loeschen = new JButton("Löschen");
		loeschen.addActionListener(this);

		cancel = new JButton("Abbrechen");
		cancel.addActionListener(this);

		infopanel = new JPanel();
		infopanel.setLayout(new BoxLayout(infopanel, BoxLayout.Y_AXIS));

		infopanel.add(lblinfo);

		btnpanel.add(Box.createHorizontalGlue());
		btnpanel.add(infopanel);
		btnpanel.add(Box.createRigidArea(new Dimension(5, 0)));
		btnpanel.add(ready);
		btnpanel.add(Box.createRigidArea(new Dimension(5, 0)));
		btnpanel.add(loeschen);
		btnpanel.add(Box.createRigidArea(new Dimension(5, 0)));
		btnpanel.add(cancel);
		btnpanel.add(Box.createRigidArea(new Dimension(5, 0)));

		mainpanel.add(btnpanel);

		getContentPane().add(mainpanel);

		setTitle("Code");
		setSize(690, 300);
		setLocationRelativeTo(null);
		setVisible(true);
		setResizable(true);
		setMinimumSize(new Dimension(690, 300));
		setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {

				setVisible(false);

				menueframe.frame.setVisible(true);

			}
		});

	}

	public static void main(String[] args) {

		new codeframe();

	}

	public void actionPerformed(ActionEvent e) {

		if (e.getSource() == ready) {
			testtext = txttext.getText();
			testcode1 = txtcode1.getText();
			testcode2 = txtcode2.getText();

			testcode1.replaceAll(" ", "");
			testcode2.replaceAll(" ", "");

			if (testtext.length() <= 100 && testcode1.length() >= 4
					&& testcode2.length() >= 4 && testcode1.length() <= 20
					&& testcode2.length() <= 20) {

				strtext = testtext;
				strcode1 = testcode1;
				strcode2 = testcode2;

				new code();

			} else {
				Object[] options = { "OK" };
				JOptionPane
						.showOptionDialog(
								null,
								"Bitte alle Felder mit ausreichend Buchstaben ausfüllen!",
								"Warnung", JOptionPane.DEFAULT_OPTION,
								JOptionPane.ERROR_MESSAGE, null, options,
								options[0]);
			}

		}

		if (e.getSource() == cancel) {

			setVisible(false);

			menueframe.frame.setVisible(true);

		}

		if (e.getSource() == loeschen) {

			txttext.setText(null);
			txtcode1.setText(null);
			txtcode2.setText(null);

		}
	}
	
	private class AL implements KeyListener {
		public AL() {
			
		}
		public void keyPressed(KeyEvent e) {

			if (e.getKeyCode() == KeyEvent.VK_ENTER) {
				testtext = txttext.getText();
				testcode1 = txtcode1.getText();
				testcode2 = txtcode2.getText();

				testcode1.replaceAll(" ", "");
				testcode2.replaceAll(" ", "");

				if (testtext.length() <= 100 && testcode1.length() >= 4
						&& testcode2.length() >= 4 && testcode1.length() <= 20
						&& testcode2.length() <= 20) {

					strtext = testtext;
					strcode1 = testcode1;
					strcode2 = testcode2;

					new code();

				} else {
					Object[] options = { "OK" };
					JOptionPane
							.showOptionDialog(
									null,
									"Bitte alle Felder mit ausreichend Buchstaben ausfüllen!",
									"Warnung", JOptionPane.DEFAULT_OPTION,
									JOptionPane.ERROR_MESSAGE, null, options,
									options[0]);
				}

			}
		}
		
		@Override
		public void keyReleased(KeyEvent e) {
			// TODO Auto-generated method stub
			
		}
		@Override
		public void keyTyped(KeyEvent e) {
			// TODO Auto-generated method stub
			
		}

	}
}
Java:
´public class code extends JFrame implements ActionListener {

	private JButton ok;
	private static String textausgabe;

	public code() {

		super();
		
		new codieren1();

		textausgabe = codieren2.textausgabe;
		
		Object[] options = { "OK", "Kopieren" };
		int n = JOptionPane.showOptionDialog(null, "Verschlüsselter Text: "
				+ textausgabe, "Fertig", JOptionPane.YES_NO_OPTION,
				JOptionPane.PLAIN_MESSAGE, null, options, options[1]);

		if (n == 0) {

			setVisible(false);

		}

		if (n == 1) {

			Toolkit.getDefaultToolkit().getSystemClipboard()
					.setContents(new StringSelection(textausgabe), null);

			Object[] options1 = { "OK" };
			JOptionPane.showOptionDialog(null,
					"Folgender Text wurde in die Zwischenablage kopiert: "
							+ textausgabe, "Fertig",
					JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE,
					null, options1, options1[0]);

		}

		if (n == 2) {

			setVisible(false);

		}

	}

	public static void main(String[] args) {

		new code();

	}

	public void actionPerformed(ActionEvent e) {

		if (e.getSource() == ok) {

			setVisible(false);

		}

	}

}

Java:
public class menueframe extends JFrame implements ActionListener {

	private static final long serialVersionUID = 1;
	private static JButton entschluesseln;
	private static JButton verschluesseln;
	private static JButton credits;
	private static JButton ende;
	private static JButton info;
	public static JFrame frame;

	public static void main(String[] args) {

		frame = new menueframe();
		frame.setTitle("Doppelwürfel");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(400, 480);
		frame.setLayout(null);
		frame.setVisible(true);
		frame.setResizable(false);
		frame.setLocationRelativeTo(null);
		frame.add(entschluesseln);
		frame.add(verschluesseln);
		frame.add(credits);
		frame.add(ende);
		frame.add(info);

	}

	public menueframe() {

		super();

		verschluesseln = new JButton("Verschlüsseln");
		verschluesseln.setBounds(120, 40, 160, 40);
		verschluesseln.addActionListener(this);

		entschluesseln = new JButton("Entschlüsseln");
		entschluesseln.setBounds(120, 120, 160, 40);
		entschluesseln.addActionListener(this);

		info = new JButton("Infos");
		info.setBounds(120, 200, 160, 40);
		info.addActionListener(this);

		credits = new JButton("Credits");
		credits.setBounds(120, 280, 160, 40);
		credits.addActionListener(this);

		ende = new JButton("Schliessen");
		ende.setBounds(120, 360, 160, 40);
		ende.addActionListener(this);

	}

	public static void code() {

		frame.setVisible(false);
		new codeframe();

	}

	public static void decode() {

		frame.setVisible(false);
		new decodeframe();

	}

	public void actionPerformed(ActionEvent e) {

		if (e.getSource() == verschluesseln) {
			code();
		}

		if (e.getSource() == entschluesseln) {
			decode();
		}

		if (e.getSource() == credits) {
			Object[] options = { "OK" };
			JOptionPane
					.showOptionDialog(
							null,
							"Programmiert von den geilen Schniten Bohnibert und Fettqualle!",
							"Credits", JOptionPane.DEFAULT_OPTION,
							JOptionPane.PLAIN_MESSAGE, null, options,
							options[0]);
		}

		if (e.getSource() == ende) {
			System.exit(0);
		}

		if (e.getSource() == info) {
			Object[] options = { "OK" };
			JOptionPane
					.showOptionDialog(
							null,
							"Der Doppelwürfel gilt als das beste Verschlüsselungsverfahren,\n"
									+ "das man alleine mit Papier und Stift ausführen kann. Im Kalten\n"
									+ "Krieg spielte diese Form des Verschlüsselns eine wichtige Rolle.\n"
									+ "Mehr dazu gibt es auf: [url]http://cryptblog.de/doppelwuerfel/[/url] .",
							"Informationen zur Doppelwürfelverschlüsselung",
							JOptionPane.DEFAULT_OPTION,
							JOptionPane.PLAIN_MESSAGE, null, options,
							options[0]);
		}
	}
}
bitte nicht über das umständliche programmieren beschweren :( bin erst seit new viertel Jahr im Geschäft :rtfm:
 
Zuletzt bearbeitet:

stg

Top Contributor
Kannst du bitte den gesamten StackTrace posten?
So kann man zunächst nur sagen, dass entweder
Code:
a
oder
Code:
b
in Zeile 306 gleich
Code:
null
ist. Ich glaube kaum, dass sonst jemand den Nerv hat wirklich Zeile für Zeile den gesamten Code durchzugehen.

Und da das Fehlverhalten offenbar von der Benutzereingabe abhängt, poste doch bitte auch noch ein konkretes Beispiel, bei dem dieser Fehler auftritt.
 

levinw98

Mitglied
StackTrace:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at prinzipp.codieren1.orderCharactersAfterFirstString(codieren1.java:306)
at prinzipp.codieren1.code1(codieren1.java:288)
at prinzipp.codieren1.<init>(codieren1.java:49)
at prinzipp.code.<init>(code.java:10)
at prinzipp.codeframe.actionPerformed(codeframe.java:191)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Ein Beispiel:
wenn ich als text (streingabe) "testtest" (8 Buchstaben) nehme und als code "test" (4 Buchstaben) funktioniert alles. Wenn ich nun aber als text "testtestx" (9 B.) und als code trotzdem "test" nehme, erhalte ich den error. Normalerweise müsste das Programm den text "testtextx" mit 3 leerzeichen auffüllen, um auf 12 B. zu kommen, dass alles wieder funktioniert.
 
T

tummo

Gast
Der Code ist ein wunderbares Beispiel dafür, wie das Kleinschreiben von Klassen für Verwirrung sorgen kann. Absolute Highlights sind dann Zeilen wie:
Java:
strtexteingabe = codeframe.strtext;
code1 = codeframe.strcode1;
Hier muss der potenzielle Helfer schon dreimal hinschauen, um zu sehen, dass codeframe kein Klassenattribut ist, sondern eine (nicht gepostete) Klasse namens "codeframe".

Ansonsten: Benutze eine IDE und den Debugger. Und mache den Code lesbar. In seiner jetzigen Form ist er einfach nur unlesbar, was wiederum dafür sorgt, dass sich niemand den Code durchliest und du keine weitergehenden Tipps außer dem bereits Offensichtlichen bekommen wirst:
So kann man zunächst nur sagen, dass entweder
Code:
a
oder
Code:
b
in Zeile 306 gleich
Code:
null
ist. Ich glaube kaum, dass sonst jemand den Nerv hat wirklich Zeile für Zeile den gesamten Code durchzugehen.
 
Zuletzt bearbeitet von einem Moderator:

levinw98

Mitglied
1. Entschuldigung, das mit dem kleinschreiben is ne dumme Angewohnheit von mir.
2. Die klasse codeframe ist gepostet.
3. Ich benutze einen IDE (eclipse).
4. Ja, deb Debugger werde ich benutzen, habe dass jedoch bis jetzt vergessen(ich bin einsteiger!).
5. "Mache den Code lesbar" : wie denn? Da so begabt bin ich noch nicht, dass ich weiß wie ich den code "lesbarer" machen kann.

Also hör bitte auf mir zu sagen was ich falsch mach und ignorier diesen post entweder oder fang an mir tipps zu geben, die mir helfen (das mit dem debugger war ja gut)
 

Schuwi

Mitglied
Also ich habe schon probiert den Code zu verstehen aber mit dieser Länge und ohne Kommentare ist das so gut wie unmöglich. Ich weiß nichtmal wo das Programm anfängt, da es ja mehr als eine main Methode hat. Also ich fürchte in dem jetzigen Zustand des Codes wird dir niemand weiterhelfen können.

P.S.: Kleiner Tipp: Statt bei code1 die ganzen Großbuchstaben durch Kleinbuchstaben zu ersetzen benutze code1.toLowerCase()
 

levinw98

Mitglied
Danke für deine Antwort :)
Habe den fehler jetzt selbst gefunden, wäre aber zu kompliziert zu erklären, da ihr meinen code ja eh nicht versteht :p

Danke euch allen :toll:
 
T

tummo

Gast
Also hör bitte auf mir zu sagen was ich falsch mach und ignorier diesen post entweder oder fang an mir tipps zu geben, die mir helfen (das mit dem debugger war ja gut)
Mal so ein paar Denkanstöße:

1. Verwende sprechende Bezeichner für Variablen, Methoden etc. Bezeichner wie l1 und z25 versteht niemand... Sprechend heißt, dass sie die Intention sofort erkennen lassen, Kommentare weitgehend überflüssig machen und sich in den Lesefluss des Codes gut einpassen.

1.1. Sprache für Java-Code ist englisch. Aber bitte auch verständliches! OrderablePair heißt "bestellbares Paar" - nimm stattdessen "sortable" - und "order after" gibt es auch nicht, das heißt "order by".

2. Zur Zeit deklarierst du einen ganzen Sack an statischen Klassenattributen, die dann lediglich in einer Methode verwendet und jedesmal beim Aufruf dieser überschrieben werden. Auf der anderen Seite verwendest du so gut wie keine lokalen Variablen. Das verstößt gegen das Prinzip, den Scope minimal zu halten, und macht durch die hohe Distanz zwischen Deklaration und Verwendung den Code schlecht nachvollziehbar. Beispiel:
Java:
private static String strtexteingabe;
...
    [viel anderer Code]
...
private static void code1() {
    strtexteingabe = codeframe.strtext;
    ...
Wandle diese zu lokalen Variablen der Methode um:
Java:
private static void code1() {
    String strtexteingabe = codeframe.strtext;
    ...

3. Der Code strotzt vor Redundanz, also unnötigem, doppeltem Code. Schaue dir an wie Schleifen und Arrays/Collections funktionieren und ersetzen z.B. diesen ganzen Quatsch mit "z1...z25"

Man könnte jetzt sicherlich noch mehr schreiben, aber ich warte erst mal ab, ob überhaupt und wie du das umsetzt ...
 

levinw98

Mitglied
Java:
package prinzipp;

import javax.swing.*;
import java.awt.event.*;

public class Menueframe extends JFrame implements ActionListener {

	private static final long serialVersionUID = 1;
	private static JButton entschluesseln;
	private static JButton verschluesseln;
	private static JButton credits;
	private static JButton ende;
	private static JButton info;
	public static JFrame frame;

	public static void main(String[] args) {

		frame = new Menueframe();
		frame.setTitle("Doppelwürfel");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(400, 480);
		frame.setLayout(null);
		frame.setVisible(true);
		frame.setResizable(false);
		frame.setLocationRelativeTo(null);
		frame.add(entschluesseln);
		frame.add(verschluesseln);
		frame.add(credits);
		frame.add(ende);
		frame.add(info);

	}

	public Menueframe() {

		super();

		verschluesseln = new JButton("Verschlüsseln");
		verschluesseln.setBounds(120, 40, 160, 40);
		verschluesseln.addActionListener(this);

		entschluesseln = new JButton("Entschlüsseln");
		entschluesseln.setBounds(120, 120, 160, 40);
		entschluesseln.addActionListener(this);

		info = new JButton("Infos");
		info.setBounds(120, 200, 160, 40);
		info.addActionListener(this);

		credits = new JButton("Credits");
		credits.setBounds(120, 280, 160, 40);
		credits.addActionListener(this);

		ende = new JButton("Schliessen");
		ende.setBounds(120, 360, 160, 40);
		ende.addActionListener(this);

	}

	public static void code() {

		frame.setVisible(false);
		new Codeframe();

	}

	public static void decode() {

		frame.setVisible(false);
		new Decodeframe();

	}

	public void actionPerformed(ActionEvent e) {

		if (e.getSource() == verschluesseln) {
			code();
		}

		if (e.getSource() == entschluesseln) {
			decode();
		}

		if (e.getSource() == credits) {
			Object[] options = { "OK" };
			JOptionPane
					.showOptionDialog(
							null,
							"Programmiert von den geilen Schniten Bohnibert und Fettqualle!",
							"Credits", JOptionPane.DEFAULT_OPTION,
							JOptionPane.PLAIN_MESSAGE, null, options,
							options[0]);
		}

		if (e.getSource() == ende) {
			System.exit(0);
		}

		if (e.getSource() == info) {
			Object[] options = { "OK" };
			JOptionPane
					.showOptionDialog(
							null,
							"Der Doppelwürfel gilt als das beste Verschlüsselungsverfahren,\n"
									+ "das man alleine mit Papier und Stift ausführen kann. Im Kalten\n"
									+ "Krieg spielte diese Form des Verschlüsselns eine wichtige Rolle.\n"
									+ "Mehr dazu gibt es auf: [url]http://cryptblog.de/doppelwuerfel/[/url] .",
							"Informationen zur Doppelwürfelverschlüsselung",
							JOptionPane.DEFAULT_OPTION,
							JOptionPane.PLAIN_MESSAGE, null, options,
							options[0]);
		}
	}
}
 

levinw98

Mitglied
[SPOILER="Jetzt ist in dieser Klasse kein Fehler mehr, aber dafür erhalte ich immer wieder das gleiche Ergebnis: code1.input = "zumTest", Codieren1.output = "bestimmtnichtso"
; wenn ich jetzt den input ändere sollte sich auch der output (auf z.B. "bestimmtso") ändern. Stattdessen erhalte ich als output wieder "bestimmtnichtso".
Das ist erst seitdem ich versucht habe meine Klassen "lesbar" zu machen. (wie soll dass mit dem ersetzen der switch methoden bei mir funktionieren?)
]
Java:
package prinzipp;

import java.util.*;

import javax.swing.JOptionPane;

public class Codieren1 {

	public static String output = "";

	public Codieren1() {

		super();

		code1();

		new Codieren2();

	}

	private static void code1() {

		String firstCode;
		String input;

		input = Codeframe.output;
		firstCode = Codeframe.firstCodeOutput;

		firstCode = firstCode.replaceAll("Ä", "ae");
		firstCode = firstCode.replaceAll("ä", "ae");
		firstCode = firstCode.replaceAll("Ö", "oe");
		firstCode = firstCode.replaceAll("ö", "oe");
		firstCode = firstCode.replaceAll("Ü", "ue");
		firstCode = firstCode.replaceAll("ü", "ue");
		firstCode = firstCode.replaceAll("ß", "ss");

		int codeLength = firstCode.length();

		double lines;

		lines = input.length() / codeLength;

		int spaces;

		if (lines - (int) lines == 0) {

		} else {

			spaces = firstCode.length() - input.length() % firstCode.length();

			for (int i = 0; i < spaces; i++) {
				input += " ";
			}
		}

		Vector<String> veclines = new Vector<String>();

		String line1 = null;
		String line2 = null;
		String line3 = null;
		String line4 = null;
		String line5 = null;
		String line6 = null;
		String line7 = null;
		String line8 = null;
		String line9 = null;
		String line10 = null;
		String line11 = null;
		String line12 = null;
		String line13 = null;
		String line14 = null;
		String line15 = null;
		String line16 = null;
		String line17 = null;
		String line18 = null;
		String line19 = null;
		String line20 = null;
		String line21 = null;
		String line22 = null;
		String line23 = null;
		String line24 = null;
		String line25 = null;

		switch ((int) lines) {
		case 25:
			line25 = input.substring(24 * (int) codeLength,
					25 * (int) codeLength);
			veclines.add(line25);
		case 24:
			line24 = input.substring(23 * (int) codeLength,
					24 * (int) codeLength);
			veclines.add(line24);
		case 23:
			line23 = input.substring(22 * (int) codeLength,
					23 * (int) codeLength);
			veclines.add(line23);
		case 22:
			line22 = input.substring(21 * (int) codeLength,
					22 * (int) codeLength);
			veclines.add(line22);
		case 21:
			line21 = input.substring(20 * (int) codeLength,
					21 * (int) codeLength);
			veclines.add(line21);
		case 20:
			line20 = input.substring(19 * (int) codeLength,
					20 * (int) codeLength);
			veclines.add(line20);
		case 19:
			line19 = input.substring(18 * (int) codeLength,
					19 * (int) codeLength);
			veclines.add(line19);
		case 18:
			line18 = input.substring(17 * (int) codeLength,
					18 * (int) codeLength);
			veclines.add(line18);
		case 17:
			line17 = input.substring(16 * (int) codeLength,
					17 * (int) codeLength);
			veclines.add(line17);
		case 16:
			line16 = input.substring(15 * (int) codeLength,
					16 * (int) codeLength);
			veclines.add(line16);
		case 15:
			line15 = input.substring(14 * (int) codeLength,
					15 * (int) codeLength);
			veclines.add(line15);
		case 14:
			line14 = input.substring(13 * (int) codeLength,
					14 * (int) codeLength);
			veclines.add(line14);
		case 13:
			line13 = input.substring(12 * (int) codeLength,
					13 * (int) codeLength);
			veclines.add(line13);
		case 12:
			line12 = input.substring(11 * (int) codeLength,
					12 * (int) codeLength);
			veclines.add(line12);
		case 11:
			line11 = input.substring(10 * (int) codeLength,
					11 * (int) codeLength);
			veclines.add(line11);
		case 10:
			line10 = input.substring(9 * (int) codeLength,
					10 * (int) codeLength);
			veclines.add(line10);
		case 9:
			line9 = input.substring(8 * (int) codeLength, 9 * (int) codeLength);
			veclines.add(line9);
		case 8:
			line8 = input.substring(7 * (int) codeLength, 8 * (int) codeLength);
			veclines.add(line8);
		case 7:
			line7 = input.substring(6 * (int) codeLength, 7 * (int) codeLength);
			veclines.add(line7);
		case 6:
			line6 = input.substring(5 * (int) codeLength, 6 * (int) codeLength);
			veclines.add(line6);
		case 5:
			line5 = input.substring(4 * (int) codeLength, 5 * (int) codeLength);
			veclines.add(line5);
		case 4:
			line4 = input.substring(3 * (int) codeLength, 4 * (int) codeLength);
			veclines.add(line4);
		case 3:
			line3 = input.substring(2 * (int) codeLength, 3 * (int) codeLength);
			veclines.add(line3);
		case 2:
			line2 = input.substring(((int) codeLength), 2 * (int) codeLength);
			veclines.add(line2);
		case 1:
			line1 = input.substring(0, (int) codeLength);
			veclines.add(line1);
			break;
		default:
			Object[] options = { "OK" };
			JOptionPane.showOptionDialog(null, "Fehler!", "Achtung",
					JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE,
					null, options, options[0]);
		}

		firstCode.toLowerCase();

		String first = firstCode;
		String second;

		switch ((int) lines) {
		case 25:
			second = line25;
			SortablePair<String> ordered24 = orderCharactersByFirstString(
					first, second);
			line25 = ordered24.b;
		case 24:
			second = line24;
			SortablePair<String> ordered23 = orderCharactersByFirstString(
					first, second);
			line24 = ordered23.b;
		case 23:
			second = line23;
			SortablePair<String> ordered22 = orderCharactersByFirstString(
					first, second);
			line23 = ordered22.b;
		case 22:
			second = line22;
			SortablePair<String> ordered21 = orderCharactersByFirstString(
					first, second);
			line22 = ordered21.b;
		case 21:
			second = line21;
			SortablePair<String> ordered20 = orderCharactersByFirstString(
					first, second);
			line21 = ordered20.b;
		case 20:
			second = line20;
			SortablePair<String> ordered19 = orderCharactersByFirstString(
					first, second);
			line20 = ordered19.b;
		case 19:
			second = line19;
			SortablePair<String> ordered18 = orderCharactersByFirstString(
					first, second);
			line19 = ordered18.b;
		case 18:
			second = line18;
			SortablePair<String> ordered17 = orderCharactersByFirstString(
					first, second);
			line18 = ordered17.b;
		case 17:
			second = line17;
			SortablePair<String> ordered16 = orderCharactersByFirstString(
					first, second);
			line17 = ordered16.b;
		case 16:
			second = line16;
			SortablePair<String> ordered15 = orderCharactersByFirstString(
					first, second);
			line16 = ordered15.b;
		case 15:
			second = line15;
			SortablePair<String> ordered14 = orderCharactersByFirstString(
					first, second);
			line15 = ordered14.b;
		case 14:
			second = line14;
			SortablePair<String> ordered13 = orderCharactersByFirstString(
					first, second);
			line14 = ordered13.b;
		case 13:
			second = line13;
			SortablePair<String> ordered12 = orderCharactersByFirstString(
					first, second);
			line13 = ordered12.b;
		case 12:
			second = line12;
			SortablePair<String> ordered11 = orderCharactersByFirstString(
					first, second);
			line12 = ordered11.b;
		case 11:
			second = line11;
			SortablePair<String> ordered10 = orderCharactersByFirstString(
					first, second);
			line11 = ordered10.b;
		case 10:
			second = line10;
			SortablePair<String> ordered9 = orderCharactersByFirstString(first,
					second);
			line10 = ordered9.b;
		case 9:
			second = line9;
			SortablePair<String> ordered8 = orderCharactersByFirstString(first,
					second);
			line9 = ordered8.b;
		case 8:
			second = line8;
			SortablePair<String> ordered7 = orderCharactersByFirstString(first,
					second);
			line8 = ordered7.b;
		case 7:
			second = line7;
			SortablePair<String> ordered6 = orderCharactersByFirstString(first,
					second);
			line7 = ordered6.b;
		case 6:
			second = line6;
			SortablePair<String> ordered5 = orderCharactersByFirstString(first,
					second);
			line6 = ordered5.b;
		case 5:
			second = line5;
			SortablePair<String> ordered4 = orderCharactersByFirstString(first,
					second);
			line5 = ordered4.b;
		case 4:
			second = line4;
			SortablePair<String> ordered3 = orderCharactersByFirstString(first,
					second);
			line4 = ordered3.b;
		case 3:
			second = line3;
			SortablePair<String> ordered2 = orderCharactersByFirstString(first,
					second);
			line3 = ordered2.b;
		case 2:
			second = line2;
			SortablePair<String> ordered1 = orderCharactersByFirstString(first,
					second);
			line2 = ordered1.b;
		case 1:
			second = line1;
			SortablePair<String> ordered = orderCharactersByFirstString(first,
					second);
			line1 = ordered.b;
			break;
		}

		int x = 0;
		int y = 1;

		for (int i = 0; i < codeLength; i++) {

			switch ((int) lines) {
			case 1:
				output += line1.substring(x, y);
				break;

			case 2:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				break;

			case 3:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				break;

			case 4:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				break;

			case 5:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				break;

			case 6:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				break;

			case 7:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				break;

			case 8:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				break;

			case 9:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				break;

			case 10:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				break;

			case 11:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				output += line11.substring(x, y);
				break;

			case 12:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				output += line11.substring(x, y);
				output += line12.substring(x, y);
				break;

			case 13:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				output += line11.substring(x, y);
				output += line12.substring(x, y);
				output += line13.substring(x, y);
				break;

			case 154:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				output += line11.substring(x, y);
				output += line12.substring(x, y);
				output += line13.substring(x, y);
				output += line14.substring(x, y);
				break;

			case 15:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				output += line11.substring(x, y);
				output += line12.substring(x, y);
				output += line13.substring(x, y);
				output += line14.substring(x, y);
				output += line15.substring(x, y);
				break;

			case 16:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				output += line11.substring(x, y);
				output += line12.substring(x, y);
				output += line13.substring(x, y);
				output += line14.substring(x, y);
				output += line15.substring(x, y);
				output += line16.substring(x, y);
				break;

			case 17:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				output += line11.substring(x, y);
				output += line12.substring(x, y);
				output += line13.substring(x, y);
				output += line14.substring(x, y);
				output += line15.substring(x, y);
				output += line16.substring(x, y);
				output += line17.substring(x, y);
				break;

			case 18:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				output += line11.substring(x, y);
				output += line12.substring(x, y);
				output += line13.substring(x, y);
				output += line14.substring(x, y);
				output += line15.substring(x, y);
				output += line16.substring(x, y);
				output += line17.substring(x, y);
				output += line18.substring(x, y);
				break;

			case 19:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				output += line11.substring(x, y);
				output += line12.substring(x, y);
				output += line13.substring(x, y);
				output += line14.substring(x, y);
				output += line15.substring(x, y);
				output += line16.substring(x, y);
				output += line17.substring(x, y);
				output += line18.substring(x, y);
				output += line19.substring(x, y);
				break;

			case 20:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				output += line11.substring(x, y);
				output += line12.substring(x, y);
				output += line13.substring(x, y);
				output += line14.substring(x, y);
				output += line15.substring(x, y);
				output += line16.substring(x, y);
				output += line17.substring(x, y);
				output += line18.substring(x, y);
				output += line19.substring(x, y);
				output += line20.substring(x, y);
				break;

			case 21:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				output += line11.substring(x, y);
				output += line12.substring(x, y);
				output += line13.substring(x, y);
				output += line14.substring(x, y);
				output += line15.substring(x, y);
				output += line16.substring(x, y);
				output += line17.substring(x, y);
				output += line18.substring(x, y);
				output += line19.substring(x, y);
				output += line20.substring(x, y);
				output += line21.substring(x, y);
				break;

			case 22:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				output += line11.substring(x, y);
				output += line12.substring(x, y);
				output += line13.substring(x, y);
				output += line14.substring(x, y);
				output += line15.substring(x, y);
				output += line16.substring(x, y);
				output += line17.substring(x, y);
				output += line18.substring(x, y);
				output += line19.substring(x, y);
				output += line20.substring(x, y);
				output += line21.substring(x, y);
				output += line22.substring(x, y);
				break;

			case 23:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				output += line11.substring(x, y);
				output += line12.substring(x, y);
				output += line13.substring(x, y);
				output += line14.substring(x, y);
				output += line15.substring(x, y);
				output += line16.substring(x, y);
				output += line17.substring(x, y);
				output += line18.substring(x, y);
				output += line19.substring(x, y);
				output += line20.substring(x, y);
				output += line21.substring(x, y);
				output += line22.substring(x, y);
				output += line23.substring(x, y);
				break;

			case 24:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				output += line11.substring(x, y);
				output += line12.substring(x, y);
				output += line13.substring(x, y);
				output += line14.substring(x, y);
				output += line15.substring(x, y);
				output += line16.substring(x, y);
				output += line17.substring(x, y);
				output += line18.substring(x, y);
				output += line19.substring(x, y);
				output += line20.substring(x, y);
				output += line21.substring(x, y);
				output += line22.substring(x, y);
				output += line23.substring(x, y);
				output += line24.substring(x, y);
				break;

			case 25:
				output += line1.substring(x, y);
				output += line2.substring(x, y);
				output += line3.substring(x, y);
				output += line4.substring(x, y);
				output += line5.substring(x, y);
				output += line6.substring(x, y);
				output += line7.substring(x, y);
				output += line8.substring(x, y);
				output += line9.substring(x, y);
				output += line10.substring(x, y);
				output += line11.substring(x, y);
				output += line12.substring(x, y);
				output += line13.substring(x, y);
				output += line14.substring(x, y);
				output += line15.substring(x, y);
				output += line16.substring(x, y);
				output += line17.substring(x, y);
				output += line18.substring(x, y);
				output += line19.substring(x, y);
				output += line20.substring(x, y);
				output += line21.substring(x, y);
				output += line22.substring(x, y);
				output += line23.substring(x, y);
				output += line24.substring(x, y);
				output += line25.substring(x, y);
				break;

			}
			x++;
			y++;
		}
	}

	static class SortablePair<T extends Comparable<T>> implements
			Comparable<SortablePair<T>> {

		final T a;
		final T b;

		public SortablePair(T a, T b) {
			this.a = a;
			this.b = b;
		}

		@Override
		public int compareTo(SortablePair<T> oth) {
			return a.compareTo(oth.a);
		}
	}

	public static SortablePair<String> orderCharactersByFirstString(String a,
			String b) {
		if (a.length() != b.length()) {
			throw new InputMismatchException(
					"Strings have to be in same length!");
		}
		List<SortablePair<Character>> list = new ArrayList<>();
		for (int i = 0; i < a.length(); i++) {
			list.add(new SortablePair<Character>(a.charAt(i), b.charAt(i)));
		}
		Collections.sort(list);

		StringBuilder outFirst = new StringBuilder("");
		StringBuilder outSecond = new StringBuilder("");

		for (SortablePair<Character> op : list) {
			outFirst.append(op.a);
			outSecond.append(op.b);
		}
		return new SortablePair<String>(outFirst.toString(),
				outSecond.toString());

	}

}
[/SPOILER]
 

levinw98

Mitglied
Java:
package prinzipp;

import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

@SuppressWarnings("serial")
public class Codeframe extends JFrame implements ActionListener {

	private JTextField txttext;
	private JTextField txtcode1;
	private JTextField txtcode2;
	private JButton ready;
	private JButton delete;
	private JButton cancel;
	public static String output;
	public static String firstCodeOutput;
	public static String secondCodeOutput;

	public Codeframe() {

		super();

		getContentPane().setLayout(new BorderLayout());

		JPanel mainpanel = new JPanel();
		mainpanel.setLayout(new BoxLayout(mainpanel, BoxLayout.Y_AXIS));

		JLabel lbltext = new JLabel("Zu verschlüsselnder Text:");
		JLabel lblcode1 = new JLabel("Erstes Schlüsselwort: ");
		JLabel lblcode2 = new JLabel("Zweites Schlüsselwort: ");
		JLabel lblinfo = new JLabel(
				"In allen Wörtern müssen ä, ö und ü durch ae, oe und ue ersetzt werden!");
		JLabel lblcodeinfo1 = new JLabel("(Min. 4, Max. 20 Buchstaben)");
		lblcodeinfo1.setFont(new Font("Arial", Font.PLAIN, 10));
		JLabel lblcodeinfo2 = new JLabel("(Min. 4, Max. 20 Buchstaben)");
		lblcodeinfo2.setFont(new Font("Arial", Font.PLAIN, 10));
		JLabel lbltextinfo = new JLabel("(Max. 100 Buchstaben)");
		lbltextinfo.setFont(new Font("Arial", Font.PLAIN, 10));

		txttext = new JTextField();
		txttext.addKeyListener(new AL());
		txtcode1 = new JTextField(
				"Entspircht dem zweiten Schlüsselwort vom Entschlüsseln!");
		txtcode1.addKeyListener(new AL());
		txtcode2 = new JTextField(
				"Entspircht dem ersten Schlüsselwort vom Entschlüsseln!");
		txtcode2.addKeyListener(new AL());

		JPanel txtpanel = new JPanel();
		txtpanel.setLayout(new BoxLayout(txtpanel, BoxLayout.X_AXIS));

		txtpanel.add(lbltext);
		txtpanel.add(Box.createRigidArea(new Dimension(5, 0)));
		txtpanel.add(lbltextinfo);

		mainpanel.add(txtpanel);

		JPanel panel1 = new JPanel();
		panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS));

		panel1.add(Box.createRigidArea(new Dimension(0, 5)));
		panel1.add(txttext);
		panel1.add(Box.createRigidArea(new Dimension(0, 5)));

		mainpanel.add(panel1);

		JPanel c1panel = new JPanel();
		c1panel.setLayout(new BoxLayout(c1panel, BoxLayout.X_AXIS));

		c1panel.add(lblcode1);
		c1panel.add(Box.createRigidArea(new Dimension(5, 0)));
		c1panel.add(lblcodeinfo1);

		mainpanel.add(c1panel);

		JPanel panel2 = new JPanel();
		panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));

		panel2.add(Box.createRigidArea(new Dimension(0, 5)));
		panel2.add(txtcode1);
		panel2.add(Box.createRigidArea(new Dimension(0, 5)));

		mainpanel.add(panel2);

		JPanel c2panel = new JPanel();
		c2panel.setLayout(new BoxLayout(c2panel, BoxLayout.X_AXIS));

		c2panel.add(lblcode2);
		c2panel.add(Box.createRigidArea(new Dimension(0, 5)));
		c2panel.add(lblcodeinfo2);

		mainpanel.add(c2panel);

		JPanel panel3 = new JPanel();
		panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS));

		panel3.add(Box.createRigidArea(new Dimension(0, 5)));
		panel3.add(txtcode2);

		mainpanel.add(panel3);

		JPanel btnpanel = new JPanel();

		btnpanel.setLayout(new BoxLayout(btnpanel, BoxLayout.LINE_AXIS));
		btnpanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));

		ready = new JButton("Fertig");
		ready.addActionListener(this);

		delete = new JButton("Löschen");
		delete.addActionListener(this);

		cancel = new JButton("Abbrechen");
		cancel.addActionListener(this);

		JPanel infopanel = new JPanel();
		infopanel.setLayout(new BoxLayout(infopanel, BoxLayout.Y_AXIS));

		infopanel.add(lblinfo);

		btnpanel.add(Box.createHorizontalGlue());
		btnpanel.add(infopanel);
		btnpanel.add(Box.createRigidArea(new Dimension(5, 0)));
		btnpanel.add(ready);
		btnpanel.add(Box.createRigidArea(new Dimension(5, 0)));
		btnpanel.add(delete);
		btnpanel.add(Box.createRigidArea(new Dimension(5, 0)));
		btnpanel.add(cancel);
		btnpanel.add(Box.createRigidArea(new Dimension(5, 0)));

		mainpanel.add(btnpanel);

		getContentPane().add(mainpanel);

		setTitle("Code");
		setSize(690, 300);
		setLocationRelativeTo(null);
		setVisible(true);
		setResizable(true);
		setMinimumSize(new Dimension(690, 300));
		setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {

				setVisible(false);

				Menueframe.frame.setVisible(true);

			}
		});

	}

	public void actionPerformed(ActionEvent e) {

		if (e.getSource() == ready) {
			String testtext = txttext.getText();
			String testcode1 = txtcode1.getText();
			String testcode2 = txtcode2.getText();

			testcode1.replaceAll(" ", "");
			testcode2.replaceAll(" ", "");

			if (testtext.length() <= 100 && testcode1.length() >= 4
					&& testcode2.length() >= 4 && testcode1.length() <= 20
					&& testcode2.length() <= 20) {

				output = testtext;
				firstCodeOutput = testcode1;
				secondCodeOutput = testcode2;

				new Code();

			} else {
				Object[] options = { "OK" };
				JOptionPane
						.showOptionDialog(
								null,
								"Bitte alle Felder mit ausreichend Buchstaben ausfüllen!",
								"Warnung", JOptionPane.DEFAULT_OPTION,
								JOptionPane.ERROR_MESSAGE, null, options,
								options[0]);
			}

		}

		if (e.getSource() == cancel) {

			setVisible(false);

			Menueframe.frame.setVisible(true);

		}

		if (e.getSource() == delete) {

			txttext.setText(null);
			txtcode1.setText(null);
			txtcode2.setText(null);

		}
	}

	private class AL implements KeyListener {
		public AL() {

		}

		public void keyPressed(KeyEvent e) {

			if (e.getKeyCode() == KeyEvent.VK_ENTER) {
				String testtext = txttext.getText();
				String testcode1 = txtcode1.getText();
				String testcode2 = txtcode2.getText();

				testcode1.replaceAll(" ", "");
				testcode2.replaceAll(" ", "");

				if (testtext.length() <= 100 && testcode1.length() >= 4
						&& testcode2.length() >= 4 && testcode1.length() <= 20
						&& testcode2.length() <= 20) {

					output = testtext;
					firstCodeOutput = testcode1;
					secondCodeOutput = testcode2;

					new Code();

				} else {
					Object[] options = { "OK" };
					JOptionPane
							.showOptionDialog(
									null,
									"Bitte alle Felder mit ausreichend Buchstaben ausfüllen!",
									"Warnung", JOptionPane.DEFAULT_OPTION,
									JOptionPane.ERROR_MESSAGE, null, options,
									options[0]);
				}

			}
		}

		@Override
		public void keyReleased(KeyEvent e) {
			// TODO Auto-generated method stub

		}

		@Override
		public void keyTyped(KeyEvent e) {
			// TODO Auto-generated method stub

		}

	}
}
Java:
package prinzipp;

import javax.swing.*;

import java.awt.*;
import java.awt.datatransfer.*;

@SuppressWarnings("serial")
public class Code extends JFrame {

	private static String output;

	public Code() {

		super();

		new Codieren1();

		output = Codieren2.output;

		Object[] options = { "OK", "Kopieren" };
		int n = JOptionPane.showOptionDialog(null, "Verschlüsselter Text: "
				+ output, "Fertig", JOptionPane.YES_NO_OPTION,
				JOptionPane.PLAIN_MESSAGE, null, options, options[1]);

		if (n == 0) {

			setVisible(false);

		}

		if (n == 1) {

			Toolkit.getDefaultToolkit().getSystemClipboard()
					.setContents(new StringSelection(output), null);

			Object[] options1 = { "OK" };
			JOptionPane.showOptionDialog(null,
					"Folgender Text wurde in die Zwischenablage kopiert: "
							+ output, "Fertig", JOptionPane.DEFAULT_OPTION,
					JOptionPane.PLAIN_MESSAGE, null, options1, options1[0]);

		}

		if (n == 2) {

			setVisible(false);

		}

	}
}
Java:
package prinzipp;

import javax.swing.*;
import java.awt.event.*;

public class Menueframe extends JFrame implements ActionListener {

	private static final long serialVersionUID = 1;
	private static JButton entschluesseln;
	private static JButton verschluesseln;
	private static JButton credits;
	private static JButton ende;
	private static JButton info;
	public static JFrame frame;

	public static void main(String[] args) {

		frame = new Menueframe();
		frame.setTitle("Doppelwürfel");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(400, 480);
		frame.setLayout(null);
		frame.setVisible(true);
		frame.setResizable(false);
		frame.setLocationRelativeTo(null);
		frame.add(entschluesseln);
		frame.add(verschluesseln);
		frame.add(credits);
		frame.add(ende);
		frame.add(info);

	}

	public Menueframe() {

		super();

		verschluesseln = new JButton("Verschlüsseln");
		verschluesseln.setBounds(120, 40, 160, 40);
		verschluesseln.addActionListener(this);

		entschluesseln = new JButton("Entschlüsseln");
		entschluesseln.setBounds(120, 120, 160, 40);
		entschluesseln.addActionListener(this);

		info = new JButton("Infos");
		info.setBounds(120, 200, 160, 40);
		info.addActionListener(this);

		credits = new JButton("Credits");
		credits.setBounds(120, 280, 160, 40);
		credits.addActionListener(this);

		ende = new JButton("Schliessen");
		ende.setBounds(120, 360, 160, 40);
		ende.addActionListener(this);

	}

	public static void code() {

		frame.setVisible(false);
		new Codeframe();

	}

	public static void decode() {

		frame.setVisible(false);
		new Decodeframe();

	}

	public void actionPerformed(ActionEvent e) {

		if (e.getSource() == verschluesseln) {
			code();
		}

		if (e.getSource() == entschluesseln) {
			decode();
		}

		if (e.getSource() == credits) {
			Object[] options = { "OK" };
			JOptionPane
					.showOptionDialog(
							null,
							"Programmiert von den geilen Schniten Bohnibert und Fettqualle!",
							"Credits", JOptionPane.DEFAULT_OPTION,
							JOptionPane.PLAIN_MESSAGE, null, options,
							options[0]);
		}

		if (e.getSource() == ende) {
			System.exit(0);
		}

		if (e.getSource() == info) {
			Object[] options = { "OK" };
			JOptionPane
					.showOptionDialog(
							null,
							"Der Doppelwürfel gilt als das beste Verschlüsselungsverfahren,\n"
									+ "das man alleine mit Papier und Stift ausführen kann. Im Kalten\n"
									+ "Krieg spielte diese Form des Verschlüsselns eine wichtige Rolle.\n"
									+ "Mehr dazu gibt es auf: [url]http://cryptblog.de/doppelwuerfel/[/url] .",
							"Informationen zur Doppelwürfelverschlüsselung",
							JOptionPane.DEFAULT_OPTION,
							JOptionPane.PLAIN_MESSAGE, null, options,
							options[0]);
		}
	}
}
 

levinw98

Mitglied
wie bekomme ich es hin, dass mein output wieder unterschiedlich angezeigt wird (S. Code)?

falls es hilft ich arbeite an einem programm für die Doppelschlüsselmethode.
 
T

tummo

Gast
wie soll dass mit dem ersetzen der switch methoden bei mir funktionieren?
Schau dir mal folgende Code-Fragmente genauer an und ersetze in Gedanken die ganzen hart-einkodierten Konstanten durch die jeweilige Zeilennummer:
Java:
switch ((int) lines) {
    case 25:
        line25 = input.substring(24 * (int) codeLength, 25 * (int) codeLength);
        veclines.add(line25);
    case 24:
        line24 = input.substring(23 * (int) codeLength, 24 * (int) codeLength);
        veclines.add(line24);
    ....
    case 1:
        line1 = input.substring(0, (int) codeLength);
        veclines.add(line1);
        break;
    default:
        ...
Sowas ließe sich doch super zu einem einzigen if-else-Konstrukt zusammenfassen (ungetestet):
Java:
String[] lines = new String[25];

if (numberOfLines > 0 && numberOfLines <= 25) {
    for (int i = 0; i < numberOfLines; i++) {
        lines[i] = input.substring(i * codeLength, (i + 1) * codeLength);
        veclines.add(lines[i]);
    }
} else {
    ... // ex default case
}
Zum anderen Switch-Konstrukt und auch der ellenlangen For-Schleife darfst du jetzt aber selbst nachdenken. Genug Ansätze sind gepostet.
 

levinw98

Mitglied
Danke erstmal für deinen Tipp :toll:

Ich habe den ersten Switch-Konstrukt jetzt so vereinfacht:

Java:
String first = firstCode;
		String second;

		if (numberOfLines > 0 && numberOfLines <= 25) {
			for (int i = 0; i < numberOfLines; i++) {
				second = veclines.elementAt(0);
				SortablePair<String> ordered = orderCharactersByFirstString(
						first, second);
				veclines.remove(0);
				veclines.add(ordered.b);
			}
		} else {
System.out.println("Fehler");
		}

nur bei dem zweiten hab ich im Moment so meine Probleme:

Hier muss ich ja einbezihen, wie lang mein firstCode ist, und wie viele numberOfLines ich habe.

Ein Ansatz von mir war:

Java:
if (numberOfLines > 0 && numberOfLines <= 25) {
			for (int i = 0; i < numberOfLines; i++) {
					output += veclines.elementAt(i).substring(0, 1);				
			}
			for (int i = 0; i < numberOfLines; i++) {
				output += veclines.elementAt(i).substring(1, 2);				
			}
			//...
		} else {
			System.out.println("Fehler");
		}

Doch hier hab ich ja bloß mit einbezogen, wie viele zeilen ich habe. Wie kann man das machen?
Ich hoffe ich nerve nicht zu sehr :(
 

levinw98

Mitglied
So?
Java:
if (numberOfLines > 0 && numberOfLines <= 25) {
			for (int i = 0; i < firstCode.length(); i++) {
				for (int j = 0; j < numberOfLines; j++) {
					output += veclines.elementAt(j).substring(i, i + 1);
				}
			}
		} else {
			System.out.println("FAIL");
		}
 
T

tummo

Gast
Ich kann dir inhaltlich nicht helfen, da ich (wie wohl alle anderen auch):
  • deinen Code aus den bereits genannten Gründen momentan weder nachvollziehen kann noch will
  • nicht weiß, was jetzt schon wieder mit einbeziehen gemeint ist
Vorerst kannst du also nur Hilfe zum Code-Aufräumen erwarten.

Vielleicht solltest du erst mal erzählen, was dieses Programm überhaupt machen/bezwecken soll ...
 
Zuletzt bearbeitet von einem Moderator:

levinw98

Mitglied
Danke es funktioniert jetzt alles :)

Mein Code ist für mich sauber genug und ich kenne mich uas ...

Und nochmal Danke für den Tipp mit den for Schleifen:
hat mir sehr geholfen:toll:
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
S Exception in thread "main" java.lang.NullPointerException at FamilienApp.main(FamilienApp.java:15) Allgemeine Java-Themen 1
I Fehler java.lang.NullPointerException Allgemeine Java-Themen 5
H java.lang.NullPointerException Allgemeine Java-Themen 5
A java.lang.NullPointerException bei Schleife Allgemeine Java-Themen 3
S javadoc java.lang.NullPointerException Allgemeine Java-Themen 2
MonsterBit java.lang.NullPointerException Allgemeine Java-Themen 2
J java.lang.NullPointerException bei Threadprogrammierung Allgemeine Java-Themen 9
J Fehler: java.lang.NullPointerException Allgemeine Java-Themen 2
J Folgender Fehler: java.lang.NullPointerException Allgemeine Java-Themen 4
G java.lang.NullPointerException JFreeChart Allgemeine Java-Themen 5
M java.lang.NullPointerException im Chatclient Allgemeine Java-Themen 12
B java.lang.NullPointerException Allgemeine Java-Themen 11
P Fehler: Hauptklasse Main konnte nicht gefunden oder geladen werden Ursache: java.lang.ClassNotFoundException: Main Allgemeine Java-Themen 24
urmelausdemeis Exception in thread "main" java.lang.Error: Unresolved compilation problem: Allgemeine Java-Themen 7
G java.lang.NoClassDefFoundError: org/aspectj/lang/Signature Allgemeine Java-Themen 2
P9cman java.Lang Klassen fehlen in JRE System Library Allgemeine Java-Themen 1
F Fehlermeldung: java.lang.NoClassDefFoundError: org/apache/commons/net/ntp/NTPUDPClient Allgemeine Java-Themen 6
P Swing Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: npoints > xpoints.length || npoints > ypoints.length Allgemeine Java-Themen 5
E HILFE !! Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils Allgemeine Java-Themen 4
J Threads - java.lang.IllegalThreadStateException Allgemeine Java-Themen 6
javaerd Binomialkoeffizient ausrechnen, Exception in thread "main" java.lang.StackOverflowError Allgemeine Java-Themen 6
T Eclipse Dll einbinden java.lang.UnsatisfiedLinkError nur in Eclipse nicht via javac Allgemeine Java-Themen 1
V Compiler-Fehler Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 125, Size: 125 Allgemeine Java-Themen 11
J Exception in thread "main" java.lang.NoClassDefFoundError Allgemeine Java-Themen 4
H Java Mail Fehlermeldung: java.lang.NoClassDefFoundError: javax/mail/internet/AddressException Allgemeine Java-Themen 5
Crooda Compiler-Fehler java.lang.NoClassDefFoundError bitcoinj Allgemeine Java-Themen 1
L Eigenener ClassLoader wirft java.lang.NoClassDefFoundError Allgemeine Java-Themen 0
F java.lang.ClassNotFoundException: .class Allgemeine Java-Themen 5
S java.lang.NoClassDefFoundError Allgemeine Java-Themen 5
J Compiler-Fehler java.lang.StringIndexOutOfBoundsException Allgemeine Java-Themen 12
D java.lang.TypeNotPresentException Allgemeine Java-Themen 3
L java.lang.OutOfMemoryError: Java heap space Allgemeine Java-Themen 10
H java.lang.OutOfMemoryError bei der wiederholten Erzeugng von Threads Allgemeine Java-Themen 8
B Variable class in java.lang.Object Allgemeine Java-Themen 11
N java.lang.IllegalMonitorStateException: object not locked by thread before notify() Allgemeine Java-Themen 2
T ProcessBuilder (java.lang.NoClassDefFoundError) Allgemeine Java-Themen 2
T java.lang.AssertionError: Allgemeine Java-Themen 4
T java.lang.ClassCastException: Allgemeine Java-Themen 4
P Java Probleme - java.lang.Thread.run(Unkown Source) Allgemeine Java-Themen 10
B java.lang.UnsupportedClassVersionError Allgemeine Java-Themen 12
M cannot be cast to java.lang.Comparable Allgemeine Java-Themen 5
B JNI - java.lang.UnsatisfiedLinkError Allgemeine Java-Themen 21
E Interpreter-Fehler java.lang.ExceptionInInitializerError Allgemeine Java-Themen 12
C java.lang.ClassCastException Allgemeine Java-Themen 3
P Fehler beim Programmstart: java.lang.NoClassDefFound Allgemeine Java-Themen 12
T java.lang.ClassCastException Allgemeine Java-Themen 7
B Java - java.lang Allgemeine Java-Themen 12
sylo java.lang.NoSuchMethodError: Obwohl Methode vorhanden Allgemeine Java-Themen 8
H Applet java.lang.reflect.InvocationTargetException Allgemeine Java-Themen 9
M SerialPort RS232 : java.lang.NoSuchFieldError: eis Allgemeine Java-Themen 2
U java.lang.ClassNotFoundException: .jar Allgemeine Java-Themen 8
G NoClassDefFoundError: java/lang/Object Allgemeine Java-Themen 4
W java.lang.ClassCastException Allgemeine Java-Themen 10
N Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.p Allgemeine Java-Themen 4
N java.lang.InstantiationException Allgemeine Java-Themen 10
D replaceAll => no such java.lang.NoSuchMethodError Allgemeine Java-Themen 5
G java.lang.LinkageError: loader constraints violation. Allgemeine Java-Themen 3
O java.lang.NumberFormatException für normalen integer Allgemeine Java-Themen 4
G Javadoc generiert keine Links zu java.lang Klassen? Allgemeine Java-Themen 4
Y java.lang.UnsupportedClassVersionError: Allgemeine Java-Themen 5
G java.lang.ClassCastException Allgemeine Java-Themen 3
E java.lang.outofmemory über windows-cmd ändern Allgemeine Java-Themen 6
I java.lang.UnsatisfiedLinkError: Allgemeine Java-Themen 8
J Exception in thread "main" java.lang.OutOfMemoryEr Allgemeine Java-Themen 26
J java.lang.StackOverflowError Debugging? Allgemeine Java-Themen 51
D java.lang.UnsatisfiedLinkError Allgemeine Java-Themen 5
S Fortran Funktion mit JNI aufrufen: java.lang.UnsatisfiedLink Allgemeine Java-Themen 2
S java.lang.UnsatisfiedLinkError mit JNI Allgemeine Java-Themen 6
reibi java.lang.Class - Resource - Solaris Allgemeine Java-Themen 17
S Exception in Thread "main" java.lang.NoClassDef. b Allgemeine Java-Themen 2
M java.lang.UnsupportedClassVersionError: Bad version number i Allgemeine Java-Themen 5
J java Thread java.lang.OutOfMemoryError: Java heap space Allgemeine Java-Themen 7
O "AWT-EventQueue-1" java.lang.ArrayIndexOutOfBounds Allgemeine Java-Themen 6
B Exception in thread "main" java.lang.NoClassDefFou Allgemeine Java-Themen 12
G Error: java.lang.OutOfMemoryError: Java heap space Allgemeine Java-Themen 2
S java.lang.OutOfMemoryError: Java Allgemeine Java-Themen 22
E Java Fehlermeldung java.lang.NoClassDefFoundError Allgemeine Java-Themen 3
G Problem mit java.lang.reflect.Field Allgemeine Java-Themen 15
P Kompilerfehler: at java.lang.ClassLoader.loadClassInternal(U Allgemeine Java-Themen 16
H java.lang.ExceptionInInitializerError Allgemeine Java-Themen 7
D java.lang.IllegalMonitorStateException: current thread not Allgemeine Java-Themen 3
P Exception in thread "main" java.lang.NoClassDefFou Allgemeine Java-Themen 3
P Exception in thread "main" java.lang.NoClassDefFou Allgemeine Java-Themen 15
P Exception in thread "main" java.lang.NoClassDefFou Allgemeine Java-Themen 3
T Profifrage: java.lang.StackOverflowError bei BigInteger Allgemeine Java-Themen 27
M java.lang.OutOfMemoryError Allgemeine Java-Themen 2
W java.lang.ClassNotFoundException Allgemeine Java-Themen 10
F java.lang.OutOfMemoryError: Java heap space Allgemeine Java-Themen 22
B Exception in thread "main" java.lang.OutOfMemoryEr Allgemeine Java-Themen 5
S fehlermeldung java.lang.OutOfMemoryError Allgemeine Java-Themen 5
S Exception in thread "main" java.lang.StringIndexOu Allgemeine Java-Themen 9
H Skalieren von Image -> java.lang.OutOfMemoryError - WARUM Allgemeine Java-Themen 18
J java.lang.ArrayIndexOutOfBoundsException Allgemeine Java-Themen 2
P Hilfe zu java.lang.Object Allgemeine Java-Themen 3
K java.lang.reflect - Getter und Setter ermitteln Allgemeine Java-Themen 8
G jTable-Problem --> java.lang.OutOfMemoryError Allgemeine Java-Themen 5
G Java.lang.Compiler Allgemeine Java-Themen 3
E Exception in Thread "main" java.lang.NoClassDefFou Allgemeine Java-Themen 5
F java.lang.OutOfMemoryError Allgemeine Java-Themen 13
R java.lang.String maximale Anzahl der Zeichen Allgemeine Java-Themen 7

Ähnliche Java Themen

Neue Themen


Oben