jeudi 5 février 2015

Random Generator with Strings ? (Java)

Hello Guys


i learning Java and i will programm a random generator but with strings... I mean as Example


User give the Strings: Ass, Pet, Dog Now The Generator use the Strings to random connect the words.


Now i have:



public void buttongeneratedClicked()
{
String ex1 =jTextField1.getText();
String ex2 =jTextField2.getText();
String ex3 =jTextField3.getText();
String ex4 =jTextField4.getText();
String ex5 =jTextField5.getText();
String ex6 =jTextField6.getText();
String ex7 =jTextField7.getText();
String ex8 =jTextField8.getText();

if(wordwish == true && randompasswd == false) {
output.append(ex1 + ex2);
output.append("\n");
output.append(ex1 + ex3);
output.append("\n");
output.append(ex1 + ex4);
output.append("\n");
output.append(ex1 + ex5);
output.append("\n");
output.append(ex1 + ex6);
output.append("\n");
output.append(ex1 + ex7);
output.append("\n");
output.append(ex1 + ex8);
output.append("\n");
}
}


And i know that is a bad Solution. How can i do that the Program work by self to connect all Strings together and when all strings are connected with the other strings he ending. I Hope anybody can help me ^^ Greetz





Aucun commentaire:

Enregistrer un commentaire