Swing Error icon in der TextArea

ehmaster

Mitglied
Hallo Java community,


Also schreibe ich Java swing apps und das ist eine teil von dieses code. Ich habe hier Java textArea und "actionPerformed" für die Buttons. wenn ich clicke "addBtn" - Button, mochte ich neben text auch error icon mit Rote Farbe in der TextArea schreiben.
Vieleicht jemand hat idee wie kann ich zugreifen. Es wird sehr hilfreich fur mich.


Vielen dank

Java:
addBtn.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {


				String name = nameField.getText();


				String password = passwordField.getText();


				String text = "";


				int length;
				length = password.length();


				if (length < 7 && name.equals("Ehemaster")) {


					text = "Password is Right and username is Right";


				}


				if (password.equals("2004") && !name.equals("Ehemaster")) {


					text = "Password is Right and username is wrong";
				}
				if (!password.equals("2004") && name.equals("Ehemaster")) {


					text = "Password is Wrong and username is Right";
				}
				if (!password.equals("2004") && !name.equals("Ehemaster")) {


					text = "Password is Wrong and username is Wrong";
				}
				if (password.equals("") && !name.equals("")) {


					text = "Please insert username and Password ";
				}


				text += " \n" + "Username:" + name + "\n" + "Password:"
						+ password + "\n" + "\n";


				fireDetailEvent(new DetailEvent(this, text));


			}


		});
 
Zuletzt bearbeitet:
Bitte bleib bei einem Problem bei einem Thema.

--

It seems that you can express yourself in english much better. It is no problem to go with it.
Please do me a favor and stick to one thread per issue!
 

Neue Themen


Zurück
Oben