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
    }
}

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM