I expect part of my frame contains the JTextArea but it occupies entirely. I cannot trace the error here.
import java.awt.*; import javax.swing.*; public cl
JFrame by default uses BorderLayout. When you just add something onto a BorderLayout component like JFrame, it would add to the very center of the BorderLayout (if you did not specify where to add the component), and it takes up the entire JFrame.
JFrame
BorderLayout
You should use the correct layout to adjust them.