GUI滚动条
(2)
package com.wang.second;

import javax.swing.*;
import java.awt.*;
/**
 * @author valive
 * @create 2021-04-07 16:28
 **/
public class JFrameDemo1 extends JFrame{

    public static void main(String[] args) {
        new JFrameDemo1();
    }
    public JFrameDemo1(){

        Container container = this.getContentPane();
        //文本域
        JTextArea TextArea = new JTextArea(20,20);
        TextArea.setText("欢迎您来到");
        //Scroll面板
        JScrollPane scrollPane = new JScrollPane(TextArea);
        container.add(scrollPane);
        this.setVisible(true);
        this.setBounds(100,100,200,300);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    }
}

576Y4C)AW1$ZW7NX88%AR`T.png

本文为作者valive发布,未经允许禁止转载!
上一篇 下一篇
评论
评论已关闭 >_<

评论已关闭