Okay, so, I am working on porting an IM client over from autoit to java, and I'm still rather new to java.
What I am attempting to do is create a 2d array where I can store every user's conversation history in the array next to their name.
Then what I want to do, is, on demand, write this chat history into an edit control, by providing the user's username, thus showing the chat history with that user on screen when asked.
Tried several variations of code.
Array functions:
public class conversations {
public static String[][] conversationspool = new String[100][];
public static String[][] init() {
for (int i = 0; i < 99; i++) {
conversations.conversationspool[i] = new String[2];
}
return conversations.conversationspool;
}
public static String startConvo(String user) {
for (int start = 0; start < 99; start++) {
if (conversations.conversationspool[start][0] == user) {
return conversations.conversationspool[start][1];
}
}
for (int start = 0; start < 99; start++) {
if (conversations.conversationspool[start][0] == "") {
conversations.conversationspool[start][0] = user;
conversations.conversationspool[start][1] = "Conversation with " + user + "";
System.out.print(conversations.conversationspool[start][1]);
return conversations.conversationspool[start][1];
}
}
return "0";
}
public static String addToConvo(String user, String html) {
for (int start = 0; start < 99; start++) {
if (conversations.conversationspool[start][0] ==
manpreet
Best Answer
2 years ago
Okay, so, I am working on porting an IM client over from autoit to java, and I'm still rather new to java.
What I am attempting to do is create a 2d array where I can store every user's conversation history in the array next to their name.
Then what I want to do, is, on demand, write this chat history into an edit control, by providing the user's username, thus showing the chat history with that user on screen when asked.
Tried several variations of code.
Array functions: