import javax.swing.*;
import java.awt.*;
public class MyScr extends JFrame {
private JPanel panel = new JPanel();
private JScrollPane scrollPane = new JScrollPane();
private BorderLayout borderLayout1 = new BorderLayout();
private JTextArea textArea = new JTextArea();
public static void main(String[] args) {
} public MyScr() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
panel.setLayout(borderLayout1);
this.getContentPane().add(panel, BorderLayout.CENTER);
panel.add(scrollPane, BorderLayout.CENTER);
scrollPane.getViewport().add(textArea, null);
}
}
import java.awt.*;
public class MyScr extends JFrame {
private JPanel panel = new JPanel();
private JScrollPane scrollPane = new JScrollPane();
private BorderLayout borderLayout1 = new BorderLayout();
private JTextArea textArea = new JTextArea();
public static void main(String[] args) {
} public MyScr() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
panel.setLayout(borderLayout1);
this.getContentPane().add(panel, BorderLayout.CENTER);
panel.add(scrollPane, BorderLayout.CENTER);
scrollPane.getViewport().add(textArea, null);
}
}
你试试