Hello,
I made a GUI application with a JTextArea, when i append some text to it, it begin change its height, now I want to add scrollbar to the Jtextarea, but I do not know how to do that. If you have any idea please let me know. Thanks in advance.
Hello,
I made a GUI application with a JTextArea, when i append some text to it, it begin change its height, now I want to add scrollbar to the Jtextarea, but I do not know how to do that. If you have any idea please let me know. Thanks in advance.
Hello,
"now I want to add scrollbar to the Jtextarea, but I do not know how to do that. If you have any idea please let me know."
The solution for your problem is to add a JScrollPane to your JTextArea. I think this is quite simple solution and you should not have any problems to do it. Still if you have queries regarding this topic then you can post and we will try to solve it.
Hello,
Even I want to add a scrollbar to the Jtextarea, but I do not know how to code that. I have tried you solution but it does not work for me. I think if you post a sample source code it would be great and it can help me a lot than just a explanation. Also, if you have any other alternative then please let me know I am the interested here. Thanks in advance.
Hello,
This is my updated code have a look at it and if you find any more problems then please guide me with the correct.
Code:JScrollPane scpn = new JScrollPane (informationRunwayEnglishTextField); contentPane.setPreferredSize (new Dimension (450, 110)); contentPane.add (scpn, BorderLayout.CENTER); sp = new JScrollPane JScrollPane (informationRunwayEnglishTextField); spane.getVerticalScrollBar (). addAdjustmentListener (new myAction () ( public void adjustmentValueChanged (AdjustmentEvent ae) ( int val = ae.getValue (); String str = Integer.toString (val); field.setText (str); } }); panelRunwayStatus.add (sp);
Hello,
You can take help of the following example, this is not the complete code, but will surely help you
Code:TextArea txar = new JTextArea(5, 30); JScrollPane scpn = new JScrollPane(txar); ... contentPane.setPreferredSize(...); ... contentPane.add(scpn, BorderLayout.CENTER);
Hello,
If you need to add a scrollbar to the Jtextarea, then here is the code to do it. This is how you can add scrollbar to it
Here is the code for the same
Hope the above will help you.Code:JScrollPane scpn = new JScrollPane(mainConsole); scpn.setBounds(10,50,760,520); scpn.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
Bookmarks