0
public class Main {
private static void createAndShowGUI() {
JFrame frame1 = new JFrame("FINAL YEAR PROJECT VER 1.0");
frame1.setSize(500,500);
frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
FlowLayout experimentLayout = new FlowLayout();
experimentLayout.setAlignment(FlowLayout.CENTER);
frame1.setLayout(experimentLayout);
JTextArea jtextarea = new JTextArea(200,200);
JScrollPane scrollingArea = new JScrollPane(jtextarea);
frame1.getContentPane().add(jtextarea);
frame1.getContentPane().add(scrollingArea, FlowLayout.CENTER);
jtextarea.setText("Welcome to Document-Query Similarity System Based On Weblogs");
frame1.setVisible(true);
}
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}
我想在JTextarea
上使用setText()
方法顯示文本。但是,字符串不顯示。我錯過了什麼?不能附加字符串到jtextarea
謝謝您的關注。你的回答解決了這個問題。謝謝你,祝你有美好的一天。 – lucian 2011-04-05 18:10:45
@lucian如果這解決了您的問題,然後單擊答案左側的複選框,以便@smas獲得積分。 – I82Much 2011-04-05 18:16:54
@ I82Much,確切地說,我的觀點在哪裏:) – smas 2011-04-05 21:29:17