java,枯燥中遇见美丽JFrame,窗体(滚动面板JScrollPane)

package com.company;

import javax.swing.*;
import java.awt.*;

public class Main extends JFrame {
    Main(){
        setBounds(100,100,500,300);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        Container c=getContentPane();
        JTextArea area=new JTextArea();//文本域
        JScrollPane sp=new JScrollPane(area);//创建滚动面板,给文本域添加滚动条
        c.add(sp);//容器添加滚动面板
        setVisible(true);
    }

    public static void main(String[] args) {
        new Main();
    // write your code here
    }
}

 

猜你喜欢

转载自www.cnblogs.com/llhhcc/p/10093498.html