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();
}
});
}
}
我正在尝试setText()
使用JTextarea
. 但是,该字符串不显示。我错过了什么?