aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JTextAera sizing issue ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTextAera sizing issue ?" Watch "JTextAera sizing issue ?" New topic
Author

JTextAera sizing issue ?

William Quantrill
Ranch Hand

Joined: Dec 23, 2002
Posts: 36
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
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

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.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTextAera sizing issue ?