JTextArea 加入滚动条

JTextArea texA;
    JScrollPane scroll;
    
    TextEdit(String name){
        super(name);
        init();
    }
    
    void init(){
        this.setBounds(100,100,600,400);
        JPanel pan = new JPanel();
        pan.setLayout(new FlowLayout(FlowLayout.CENTER));
        pan.setBackground(Color.YELLOW);
        
        texA = new JTextArea("34reterte35",20,30);
        scroll = new JScrollPane(texA);
        pan.add(scroll);
        this.add(pan);
    }

 

posted @ 2015-11-08 12:17  喵小喵~  阅读(371)  评论(0)    收藏  举报