I would like to make a window with a given size, and a scrollable textarea to a given place within.

When I tried the same with a button instead of textarea, it was no problem: make a JFrame, put a JPanel inside, put a JButton on the panel. Then call myPanel.setLayout = null to kill the layout manager, and myButton.setBounds(...) to place the button where I want.

The problem is, I tried to use a JScrollPane and a JTextArea in the same way, but setting myScrollPane.setLayout = null makes the scrollbar not appear. If I do use the layout manager, the scrollbar does appear, but the attempts to force the placement usually ended in strange results.

Do you have any idea how to fix it?

4 Years
Discussion Span
Last Post by subhraakasuny

you can add a id to the text area,and add the follwing attribute for the corresponding id in the head tag like

        overflow: scroll; 
        overflow-y: scroll; 

<textarea rows="4" cols="20" id="scrolltext"> </textarea>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.