Im hoping this is just simple, but I have a main class for my GUI and I do some printing in another class called board, which gets its information from my peg class, which gets its information from my linked list.
Is there and easy way to print my pegs out onto my JTextPane because System.out.print
just prints out to the console. I'll show my functions here just in case its a little more complicated like having to change my void functions to string to return a value. If that is the case could some please let me know how to do that because ive tried before and couldnt do it.
This stuff works fine in my main class like this, where display is just what ive called my instance of the JTextPane
MAIN CLASS
display.setText("\n\n*** Bad Input, please try again! \n");
This is where I start having trouble
BOARDCLASS
public void printBoard(){
System.out.print("\n\n\n\n\n\n\n\n|");
peg1.print();
System.out.print("|");
peg2.print();
System.out.print("|");
peg3.print();
System.out.print("\n\n\n\n\n\n\n");
if(peg3.topNum() == 1 && peg2.topNum() == peg1.topNum()){
gameFinish = true;
}
//do some debugging
System.out.println(peg1.topNum() + "" + peg2.topNum() + "" + peg3.topNum());
}
PEG CLASS
public void print() {
printList();
}
LLIST CLASS
public void printNode(llnode node) {
if (node != null) {
printNode(node.nextNode());
System.out.print(node.dataVal() + " ");
}
}
LLNODE CLASS
public int dataVal() {
return data;
}