Czy jest możliwość dodania do tekstu za pomocą zmienna.append() do TextArea który znajduje sie w scrollbarze ?
Oto moje części kodu:
Tu znajduje sie Scrolbar z JTextArea
public class TestFrame extends JFrame implements ActionListener {
//public static boolean win2 = CheckWin.win;
public JTextArea tekst = new JTextArea();
public JScrollPane sp = new JScrollPane(tekst);
public void tekst(){
sp.setBounds(5, 300, 250, 200);
String X,O;
X = ("ruch wykonuje O");
O = ("ruch wykonuje X");
tekst.setText("siea ruch wykonuje X\n");
add(sp, BorderLayout.WEST);
}
A tutaj jest klasa z której chce wysłać coś do JTextArea :
public class CheckWin extends TestFrame {
public static JButton checktable[][] = TestFrame.przy;
public static String X;
public static boolean win = false;
public static boolean abc() {
if(CheckWin.win==true){
tekst.append(CheckWin.X + "\n");
tekst.append("KONIEC GRY !\n");
}
}
}
Da rady to zrobić ?