This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I need a text box that is able to scroll (horizontal only). Ive placed a JTextArea next to a button. When i start entering text into the textarea and the scrollbars become visible, it covers my textarea. how can i adjust for this ?
"The Rebel army is now the legitimate property of the Army of the Potomac." - Joseph Hooker spoke these pompous words shortly before he was soundly defeated by Robert E. Lee at Chancellorsville
What sort of layout are you using in the component that holds the text area?
What you might want to do is set JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS so you can account for the size of the scrollbar when initially laying out your components. The side effect is that there will be a scrollbar in your text area even when you don't really need one, but you won't have the problem you are having now.
Also, unless you absolutely need the actual scrollbar to scroll, you could just use a JTextField. You can enter Strings longer than the textfield and then scroll through them using the arrow keys when the textfield has focus.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.