Game
classと classの 2 つのクラスがありwampusGUI
ます。wampusGUI
クラスには、method の下に名前がtextarea
付けられたものがあります。クラスから結果を出そうとしています。しかし、そのクラスからアクセスしようとしているとき。正常に実行され、結果もそのクラスに入っています(単純 な方法でテストしただけです)が、に追加されていません。これが私のコードです。displayTextArea
textarea1()
append
textarea
Game
function
System.out.print()
textarea
// Code of wampusGUI class
public class wampusGUI extends javax.swing.JFrame {
/**
* Creates new form wampusGUI
*/
public wampusGUI() {
initComponents();
}
public void textArea1(String text) {
System.out.print(text);
displayTextArea.append(text); // this is not appending to textarea.
}
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new wampusGUI().setVisible(true);
Game g = new Game();
g.testing();
}
});
}
//Gameクラスのコードはこちら
private wampusGUI gui;
public void testing () {
String welCome=welcome();
gui= new wampusGUI();
gui.textArea1(welCome);
}