I tried to add sroll bars to a textarea with the following code. It is not wrkin. Show me a way out!

I just wanna add scrol bars to the textArea.

class srolpane extends JFrame{

     private JTextArea  txtAr; 
     private JScrollPane  srlpane;

    private scrolpane(){

            txtAr = new JTextArea();
            txtAr.setBounds(250,50,400,425);


            srlpane= new JScrollPane(txtAr);
            add(srlpane);

    }

}

srolpane vs. scrolpane()

that is not the problem ......(its happend when I paste the code here.. sorry)

class scrolpane extends JFrame{

private JTextArea txtAr;
private JScrollPane srlpane;

private scrolpane(){

txtAr = new JTextArea();
txtAr.setBounds(250,50,400,425);


srlpane= new JScrollPane(txtAr);
add(srlpane);

}

}

Your constructor is private. Where do you call it from?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.