JTextArea
component that lets you edit some text.
import javax.swing.*;
public class JFrameTester {
public static void main(String[] args) {
JFrame myFrame = new JFrame("My JFrame");
myFrame.setSize(250, 250);
myFrame.setLocation(300,200);
myFrame.getContentPane().add("Center", new JTextArea(10, 40));
myFrame.show();
}
}
JFrames (and Swing containers in general) differ from AWT frames (and AWT containers in general) in that you must add component's to the JFrame's content pane rather than directly to the frame itself. Furthermore JFrames are closeable by default whereas AWT frames are not.