• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

JTextAera sizing issue ?

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
She'll be back. I'm just gonna wait here. With this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic