Vertical scroll ONLY

Hi,
I'm trying to make a JTextArea scrollable in vertical direction only. I've not found even one solution on this forum and many others.
AWT version of JTextArea (ie TextArea) allowed vertical or horizontal scroll only, simply with constants given to the constructor. But in Swing version (ie JTextArea), nothing... :-o
My JTextArea used word-wrap, so that's why I don't want a hrz scroll, cause when i've got such a both-direction-scroll, word-wrap is no more required since JTextArea width increased...
I tried this :
JScrollPane scrollPane = new JScrollPane(textArea,
     JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
     JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);of course, even if the horz scrollbar was no more visible, the jtextarea width was still extended.
I just want something like a Word document, like a simple textarea on a web page, and so on...
so I tryed to force the textarea width to match the viewport width with a "resize-listener" :
scrollPane.addComponentListener(new ComponentAdapter()
  public void componentResized(ComponentEvent e)
    Dimension dim = new Dimension(scrollPane.getViewport().getWidth(),
     (int)textArea.getPreferredSize().getHeight());
    textArea.setPreferredSize(dim);
    textArea.revalidate();
});it looks better but now my vertical scrollbar doesn't scroll the entire document (the scrollpane thinks textarea is smaller than it is) this is surely due to the line wrap, but I don't know how to deal with it...
please help !
many thanks in advance :)

This is what i do, and it usually works:
list = new JList(aListOfItems);
scrollPane = new JScrollPane(list);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);          
scrollPane.setMaximumSize(new Dimension(160,200));
I've sometimes found that if i fail to set the scrollpane's size, it does not come up on screen properly, so maybe that's your problem.
By the way, there are 6 arguments that the setHorizontalScrollBarPolicy / setVerticalScrollBarPolicy method can take:
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED
JScrollPane.VERTICAL_SCROLLBAR_NEVER
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED
It's pretty obvious what they mean.

Similar Messages

  • Creating JScrollPane with vertical scroll only...

    Anyone got any idea how to use a JScrollPane to perform vertical scrolling only?
    The components should be stacked vertically, as wide as the scrollpane and as high as they need to be.
    Is it only possible by adding a ComponentListener to the JScrollPane (or the JViewPort) and setting the maximum width of the components to the width of the viewport?
    Incidentally, anyone know how a JLabel (or any text component) calculates its preferred size when it can wrap the text contained? Ie, how do you get the preferred height for a specified width?

    Doh - implement Scrollable to return true for getScrollableTracksViewportWidth()!

  • Vertical scrolls only one direction

    First, I found the vertical scrolling was in reverse.  After going through system preference->mouse and check the "move content in the direction of finger movement when scrolling or navigating" I got it to move to the direction I want (i.e. as before).
    Now for some reason, I can only scroll to one vertical direction regardless how I rotate the mouse center button.  It is so annoying that I have to click on the vertical bar and move it while holding the mouse down.  Any help on fixing this is appreciated.

    I fixed it, all I need to do is press the little center button down hard while rolling it around.  Maybe there was some dirt stuck in the ball.  I am good now.

  • Vertical Scroll in iTunes 11 Keeps Disappearing

    I'm having a problem with the vertical scroll feature on the righthand side of iTunes 11. It keeps disappearing on me. If I adjust the size of the Itunes window, it'll show up, but only momentarily. Eventually it disappears. I have to re-adjust iTunes's window when I want to use it again.  Also, in the new Expanded View, if an album has more tracks than can be seen in the window at one time, I need the vertical scroll, only it's not there!  Until I re-size the window. But as soon as I click on a track, the vertical scroll disappears. I wouldn't mind it fading away when I'm not using it, but I'd like for it reappear when I need it.
    Is there any way to lock the scroll bar on the right hand side?

    After playing around with iTunes a little, I've figured out a solution. I didn't mention it in my previous post, but I am using iTunes 11 on a MacBook Pro.
    The quickest way to temporarily bring back the vertical scroll bar on MacBook Pro:
    Use the two finger scroll technique on your multi-touch track pad. Do a two-finger tap and the scroll bar will briefly reappear.
    It's funny, your brain gets so used to using iTunes one way that you don't think to use the techniques you use with different programs. My solution almost seems self-evident.
    The scroll bar is everpresent in the PC version iTunes 11 on a PC. I just wish this was the case for Macs. It seems like it scrolls more slowly too.

  • I have a new IMAC. My mouse (very sensible) gave me the possibility to move left to right and right to left and also to scroll on the vertical way also on my page word. I like the vertical way, it is ok, but is it possible to block the vertical move only

    Hi, I have a new IMAC. Only by touch, my mouse (very sensible) gave me the possibility to move left to right and right to left on my pages word and also to scroll on the vertical way. I am ok with the vertical way, but I don't like the very sensible horizontal way. Do someone know a way to block the vertical move only and keep the move of the horizontal way? The only way I found blocked all the moves.
    I hope my descripion is understandable... English is not my habitual language.
    Danielle

    Merci Éric de me revenir en français, je l'apprécie beaucoup. Je ne veux conserver que le mouvement de haut en bas et de bas en haut. Je ne vois pas l'utilité du mouvement horizontale (gauche-droite, droite-gauche) et pire encore, par mégarde je fais trop souvent bouger ainsi mon texte et cela m'embête, même me dérange  beaucoup. Même que cela me donne même mal au coeur hahahahahaha!
    Par contre, ma souris précédente avait le mouvement de défilement du haut en bas et bas en haut et cela par contre m'est très utile. Je voudrais donc savoir s'il existe un moyen de stopper le mouvement de côté mais conserver tout de même la fonction du mouvement haut-bas et bas-haut avec le simple toucher de la souris. Suis-je plus clair? Disons que c'est plus aisé pour moi en français. merci à toi
    Danielle

  • Missing VERTICAL SCROLL-BAR only in the TV Shows tab.

    *I keep losing my vertical scroll-bar while looking at Television shows.* I believe this might be related to the Windows Vista 64-Bit platform.
    What-ever it is, this problem has been occurring since iTunes version 9.x for sure. I am *currently on iTunes version 10.0.0.68* with the same annoying "find the vertical scroll-bar" problem. I have reported my concerns to Apple, but their has never been a reply and the problem has +migrated beyond iTunes 9.x now.+
    The following are all examples of how or when...
    1. enter the "TV Shows" tab for the first time since I started iTunes.
    ( as in today, last hour, or just xx minutes ago. )
    ( of course just closing iTunes and restarting iTunes )
    ( has not constant result. )
    2. just got done watching a television episode in a separate window.
    3. just got done watching a television episode in the same or list window.
    4. switched from one view style to another view style.
    5. enter the "TV Shows" tab from another tab such as "Music" or "Podcasts".
    The only way to get the scroll-bar back is to switch to another tab and then switch back to "TV Shows". This sometimes takes 5 to 6 switches before the scroll-bar returns. And of course, it might disappear again if any of the above 1-5 examples occur.
    I do have a couple of screenshots for anyone to view, not sure how to post it as part of this post. If you desire, request the screenshots and I will e-mail them to you for your reference.

    I also have this issue with the scroll bar in Mail since upgrading from Leopard to Snow Leopard. I Google it... and that is what brought me here, so hopefully someone knows what is going on as I was kind of hoping that 10.6.1 would have fixed this.

  • At times when dragging the vertical scroll bar my computer screen oscillates up and down for some time before going blank or not responding to any clicks requiring a forced system restart. What is wrong?

    Hi,
    Suddenly while working with Firefox if I happen to drag the vertical scroll bar, a very abnormal behavior occurs. My screen dances up and down for a short time before either going black or getting restored but with no clicks working. The only way to resume is to force a restart of the system.
    Any help would be deeply appreciated.
    Thanks and Regards
    Deepak

    That didn't work. On trying to install a new driver I got the error the graphics driver could not find compatible graphics hardware. Is there anything else that can be done to at least prevent the hanging of the computer even if it means less features from Firefox being available?

  • Vertical Scroll bars in analysis - View all rows

    Users want to see the whole report displayed in one page with only a vertical scroll bar. They do not want the up/down arrows. Is this possible in OBIEE?
    Thanks.
    Ad

    To implement the solution, please do:
    1. Change instanceconfig.xml file in <biee11g_install>\instances\instance1\config\OracleBIPresentationServicesComponent\coreapplication_obips1 as following
    <Views>
    <Pivot>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager-->
    <DefaultRowsDisplayedInDelivery>75</DefaultRowsDisplayedInDelivery>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager-->
    <DefaultRowsDisplayedInDownload>2500</DefaultRowsDisplayedInDownload>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager-->
    <DisableAutoPreview>false</DisableAutoPreview>
    <MaxVisibleColumns>5000</MaxVisibleColumns>
    <MaxVisiblePages>2500</MaxVisiblePages>
    <MaxVisibleRows>500000</MaxVisibleRows>
    <MaxVisibleSections>5000</MaxVisibleSections>
    </Pivot>
    <Table>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager-->
    <DefaultRowsDisplayedInDelivery>75</DefaultRowsDisplayedInDelivery>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager-->
    <DefaultRowsDisplayedInDownload>2500</DefaultRowsDisplayedInDownload>
    <MaxVisiblePages>2500</MaxVisiblePages>
    <MaxVisibleRows>500000</MaxVisibleRows>
    <MaxVisibleSections>5000</MaxVisibleSections>
    </Table>
    </Views>
    3. Note the new elements added are the following to both <Pivot> and <Table>, the Pivot part controls Pivot view, and Table part controls Table View, my testing was done with Table View.
    <MaxVisiblePages>2500</MaxVisiblePages>
    <MaxVisibleRows>500000</MaxVisibleRows>
    <MaxVisibleSections>5000</MaxVisibleSections>
    4. Restart Presentation Server from EM, then run your request, do excel export to verify.
    Thanks...

  • Disable Vertical scroll but enable Page down in Table control for BDC

    Hello All
    In my 4.6C sysem , i had enabled Scroll bar in table control by  populating TABC-lines = <No of records>...Then when i try to capture the BDC recording of this , then the scrolling event is not captured in BDC , as we all know.....
    So i put few buttons on the application bar as NEXT PAGE, NEXT LINE , PREV PAGE n PREV LINE...and i did the scrolling by writing the code manually in PAI...and that is getting captured in BDC so my problem is partially solved...
    Now as u see..i have default working Scroll bar on my T.C..also i have my buttons on the application bar....i want to get rid of the vertical scrolling....so now i am NOT populating the TABC-lines field...But as soon as i do this , my  buttons stopped also working...Any idea how to get rid of this ?
    In short when i don't write : TABC-lines = no_of_records .....to remove vertical scroling.......my manual scrolling mechanism also getting disabled..
    Is it possible to remove only vertical scrolling ?
    Thanks in advance .
    Nilesh

    No reply from any one ???

  • Need help with scroll effects for horizontally + vertically scrolling website

    Hi,
    I recently came across a website that uses both horizontal and vertical scrolling where 1 scroll = full browser length move to the next section (as opposed to several rotations in a continuous motion of the mouse ball like the majority of websites). Please see the example here because I'm probably not explaining this very well : A Chocolate Bar, Restaurant and Shop for Chocolates, Fondue, Gift Boxes, and More | Max Brenner (http://maxbrenner.com).
    I'm wondering if this effect is something that can be done in Muse and if so, how to do it. It's something I'm seeing more and more and almost behaves like a slideshow that can be controlled by scrolling.
    Thank you!
    Michele

    Hi Michele,
    I am afraid that this is not possible out of the box at this stage, I will recommend that you post this on the ideas section over here, Ideas for features in Adobe Muse
    You can, in the mean time, use some CSS to disable the scroll bar, preventing the partial scrolling of the page and disabling the mouse wheel scrolling as well, leaving behind only your navigation to scroll through the page.
    - Abhishek Maurya

  • Removing the Vertical scroll bar from the content area.

    Hello,
    Is there a way to remove the vertical scroll bar from the content area?
    I am trying to create a new light portal frame work.
    Everything works fine except that I see two vertical scroll bars, one from the content area and another from the page(frame).
    Thanks in advance.
    -Sudheer

    Hi
    There are a couple of ways in which to achieve this
    1) Try and make the content flat. What I mean by this is that the content area (when using the standard light framework) doesn't contain an iframe, meaning that the iview defined on the page has "EMBEDDED" isolation mode. This should mean that you only have one scrollbar (if the content extends past the size of the browser)
    2) If you need to make the iview URL isolation, then try and get the domain of the content to be of a similar domain to your portal server, i.e. your portal is portal.company.com and the content is content.company.com. In this way you can make the pages expand.
    NOTE: One thing to note is that when using URL isolation iviews doesn't allow the automatic expanding of the iframe content. This is because the standard javascript doesn't allow this. Therefore you may have to write your own javascript function (or content area page) to do this
    I hope this helps
    Darrell

  • Remove vertical scroll bar from table control

    hi,
    i had used table control in my application. i want remove vertical scroll bar from table control.
    At initial time in table control there is no vertical scroll bar. In my table control lines are dependent on internal table which i was used to fill it.
    i was used these code for to set table control lines.
    DESCRIBE TABLE IT_RISK_ZINRISEXC LINES EXC_LINE.
    TC_RISK_EX-LINES =   EXC_LINE .
    Initially there is no data in internal table so there is no vertical scroll bar. After getting value i am filling internal table. and there is scroll bar in my table control. but i does not want that.
    i was not selected RESIZING-VERTICAL OR -HORIZONTAL.

    Hi,
    From Scroll Bars in Table Control
    You can remove the scroll bar in the table control by switching off horizontal and vertical scrolling in the properties of the table control. The properties can be accessed from the screen painter by double clicking on the table control. Regarding the page up and page down functions, I believe you add those buttons in the screen layout and code for them. You can use the standard function code for the page up and page down functions.
    or
    You can get rid of the vertical scroll bars by not setting table control lines. This way the user can only see the visible lines of the table control. As for the horizontal scrollbar, just make sure that your table control doesn't contain too many fields.
    Regards,
    Raj.

  • Bottom right corner resize controls trump vertical scroll button if set to appear in the bottom corner

    My bottom right corner square of the Firefox window normally sits below the bottom of the vertical scroll bar and right of the horizontal scroll bar if one exists. The square is used to click and drag to resize the window's right and bottom boundaries.
    At issue is when a web site places its vertical scroll down-arrow button in the bottom right corner. I cannot access the down-arrow button with my mouse to cause the page to scroll down a few lines at a time because when I point the mouse there, I get the resize controls instead. Even though the down-arrow button is plainly visible on the screen, the resize controls take charge and I cannot use the scroll control.
    Two example web sites display their down-arrow control at the very bottom of the window; TIME.com and GMAIL.com. I have also viewed two PDF documents in the browser, and they too, have a vertical scroll bar all the way to the bottom, and I cannot use that down-arrow button because instead I get the northwest-southeast click-to-resize cursor instead of the mouse pointer when I attempt to use that button for scrolling.
    Someone on the Google Help forum was not able to replicate that issue, showing me screenshots of his lower right corner mouse behavior. He does not have the resize control covering access to the scroll bar.
    I am using the latest Firefox, I have reset Firefox, thus dumping all of my add-ons and custom settings, and have only put back AdBlock Plus and Cookie Monster. And Troubleshooter, when I asked a similar question.
    I am running Windows XP, on its last days of support. This computer is not capable of running anything newer, unless I run with Linux.
    Going to TIME.com, its vertical scroll is in the bottom corner and I get the resize control arrows instead of the mouse pointer when I point to the down-button. If I disable page styles in the View menu, I get a useful output that sets the end of the vertical scroll above the bottom corner. So somebody's idea of styling the page (CSS) creates this issue for me.
    Going to Gmail, turning off the styles gives me a useless output of nonsense, so I must use page styling enabled.
    Can someone please give me some guidance? This forum page has vertical and horizontal scroll above and left of the bottom corner square. I have access to all the parts of both scroll bars, as is the case on most well-designed pages.
    My window-resize controls are in charge always of the bottom corner square even if the vertical scroll is supposed to be there.
    See also my first wording of this question: https://support.mozilla.org/en-US/questions/993519

    Those layout.css prefs are about enabling some CSS feature, in this case vertical writing, so have nothing to do with scroll bars.
    *Bug 772321 - implement CSS parsing of writing-mode property
    *resource://gre/greprefs.js
    <pre><nowiki>// Is support for CSS vertical text enabled?
    pref("layout.css.vertical-text.enabled", false); </nowiki></pre>
    Can you attach a screenshot?
    *http://en.wikipedia.org/wiki/Screenshot
    *https://support.mozilla.org/kb/how-do-i-create-screenshot-my-problem
    Use a compressed image type like PNG or JPG to save the screenshot.

  • Firefox Vertical Scroll Bar Not Functioning Properly

    == Issue
    ==
    Firefox is having problems with certain web sites
    == Description
    ==
    As I visited the referenced Web page, although the page displays normally, vertical scrolling is impaired. Clicking and dragging the vertical scroll "handle" DOES work. However, to scroll up or down by the height of the browser's display area, you'd click in the "blank space" immediately above or below the vertical scroll handle (comparable to using your keyboard's PageUp or PageDown buttons), and this is the scrolling method that does not work. Clicking the vertical scroll arrows does not work either.
    == URL of affected sites
    ==
    http://www.snopes.com/politics/obama/memorialday.asp
    == Troubleshooting information
    ==
    AVG Safe Search 9.0.0.825 true {3f963a5b-e555-4543-90e2-c3908898db71}
    DownloadHelper 4.7.3 true
    Google Gears 0.5.36.0 true {000a9d1c-beef-4f90-9363-039d445309b8}
    Java Console 6.0.13 true
    McAfee SiteAdvisor 3.0 true
    Microsoft .NET Framework Assistant 1.2.1 true {20a82645-c095-46ed-80e3-08825760534b}
    ScrapBook 1.3.7 true {53A03D43-5363-4669-8190-99061B2DEBA5}
    Xippee Extension 2.51 false [email protected]
    Yahoo! Toolbar 2.1.2.20100119091315 true {635abd67-4fe9-1b23-4f01-e679fa7484c1}
    Evernote Web Clipper 3.0.0.82006 true
    Java Console 6.0.15 true
    Java Console 6.0.16 true
    Java Console 6.0.17 true
    Java Console 6.0.18 true
    == Firefox version
    ==
    3.6.3
    == Operating system
    ==
    Windows Vista
    == User Agent
    ==
    Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)
    == Plugins installed
    ==
    *-Shockwave Flash 10.0 r45
    *np-mswmp
    *NPRuntime Script Plug-in Library for Java(TM) Deploy
    *Winamp Application Detector
    *Adobe PDF Plug-In For Firefox and Netscape "9.3.2"
    *Default Plug-in
    *Google Update
    *Adobe Shockwave for Director Netscape plug-in, version 11.0
    *iTunes Detector Plug-in
    *DivX® Web Player
    *DivX® Content Upload Plugin
    *npdivxplayerplugin
    *GEPlugin
    *Yahoo Application State Plugin version 1.0.0.7
    *3.0.50106.0
    *Office Live Update v1.5
    *NPWLPG
    *Windows Presentation Foundation (WPF) plug-in for Mozilla browsers
    *Google Updater pluginhttp://pack.google.com/
    *6.0.12.69
    *RealPlayer(tm) LiveConnect-Enabled Plug-In
    *RealJukebox Netscape Plugin
    *Allows browsing on RealArcade sites with Mozilla browsers.
    *Rhapsody Player Engine Plugin
    *Java(TM) Platform SE binary
    *Next Generation Java Plug-in 1.6.0_18 for Mozilla browsers
    *The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.

    This may or may not be related, but I was having a similar issue, and it was affecting the same page in Chrome as well!
    Turns out my issue was that the page was calling home via AJAX and my bandwidth at the moment was impaired, as I was downloading a big file.
    Once I stopped the download, everything went back to normal, with only a tiny hiccup on the page scrollbars once every some seconds, where they would get stuck for a few milliseconds.
    This is probably caused by the page using synchronous AJAX calls, instead of asynchronous ones. Synchronous calls will block the browser until a response is received from the server. If bandwidth is compromised, this response will be delayed or even worse, not received at all, in which case the page will stop working (or at least this seems like what would happen, don't know if it is actually true).
    Hope this helps.

  • How to fix double vertical scroll bar in responsive output

    After implementing the solution provided for the question 'Responsive HTML5 Output: How to auto adjust the screen resolution for all devices?', the function bar in output does not appear and also another vertical scroll bar in the output. I edited the max-width value in the layoutfix.min.css file and fixed the function bar issue. How can I do away with the additional vertical scroll bar?

    I've looked into the issue.
    @Delennish: In your case, the size of the iframe is too large, or you have an extra empty element below the iframe. You can try 2 things:
    1. Best solution but may have side effects: In the main.css, add the following code:
    div.contentholder { overflow: hidden !important;}
    For this option, please check for undesired side effects.
    2. Works, but is ugly: In the main.css, add the following code:
    div.floatholder iframe.wTopic { height: 95% !important;}
    Try playing with the height setting until the 2nd scrollbar disappears.
    @CarolW: The layout you're using is very old. I've made a new responsive layout with TOC only. Please use that one instead: http://www.wvanweelden.eu/sites/default/files/attachments/Theme1_Standard_TOC_Only.zip (I'll update my site with this new version later.)

Maybe you are looking for

  • Are there any performance benchmark tools for Flash?

    I am looking to benchmark Flash on various computers that I use.  I was surprised that the performance of Adobe Flash on my Intel i5 computer running Windows 7 Pro 64-bit OS and IE 10 was MUCH WORSE than running on a Windows 7 Pro 32-bit on an Intel

  • How to stop the running infospoke

    Hi Experts, there is a infospoke is still running so long time, it's incorrect, i'll cancel it as kick off the dependenies, i have no idea to how to stop the running infospoke. Anybody could tell me how to do it. thanks in advance.

  • Create FTP adapter

    Hello, I need to get file from external FTP server. I create the adapter on steps: 1. Login to Weblogic Admin Console 2. Navigate to Deployments --> FtpAdapter --> Configuration- Tab --> Outbound Connection Pools 3. Expand javax.resource.cci.Connecti

  • Migration from MS SQL7 to Oracle 8i

    Has any one successfully migrated from MS SQL7 to Oracle 8i (basically tables & stored procedures). Any suggestion would be greatly appreciated. Thanks Anish null

  • Login screen appears on wrong monitor

    This problem started when I upgraded from Mavericks to Yosemite 10.10.2. It persists on 10.10.3 I have two monitors; the main one is 26", the other is 17". Both are NEC. The main monitor connects with a DVI-to-Mini display port adapter. The 2nd with