• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

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.
 
Pay attention! Tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic