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