我試圖將輸出傳遞給文本區域。在Java中將數據從一個類傳遞到另一個類
我有Class Search
它處理所有的搜索和顯示輸出使用System.out.println()
。
我已經創建了Class GUI
以使控制檯輸出(System.out.println())
出現在JTextArea
中。
我想通過使用對象將數據傳遞到文本區域,但我不知道它爲什麼不工作。
Class Search
有這種方法,計算輸出:
public static void searchIndex(String searchString) throws IOException, ParseException
Class GUI
有text1
課堂GUI我已經試過這樣:
text1.setText(Search.searchIndex(searchString));
,但它給我一個錯誤searchString cannot be resolved to a variable
有什麼建議嗎?
問候。
是;從Java教程開始:http://download.oracle.com/javase/tutorial/ –