Add scroll bars to TextArea - how?

I have an application which reads user input to a text file and then on click of JButDisplay reads the contents of the file to a TextArea.
Problem is I can't seem to get scroll bars onto the TextArea, I tried using JScrollPane,
but had no luck (I'm using gridBagLayout)
Could someone please advise me how to add scrollbars to this component?
TADisplay2 = new JTextArea(10,20);     
               c.ipadx = 12;
               c.ipady = 12;
                    c.gridx = 2;
                    c.gridy=18;
                    c.gridwidth = 2;   //2 columns wide
                    c.gridheight = 4;
                         gridbag.setConstraints(TADisplay2, c);
                         contentPane.add(TADisplay2);

1) Create scrollPanel
2) Make it fill your content pane (or whatever area you wish to cover)
3) Add your textArea to the scrollpanel

Similar Messages

  • How can I hide the scroll bar in TextArea?

    How can I hide the scroll bar in TextArea?

    Hi. To remove the horizontal scrollbar you can do this:
    textArea.setWrapText(true);
    To remove the vertical scrollbar you can do this:
    ScrollBar scrollBarv = (ScrollBar)ta.lookup(".scroll-bar:vertical");
    scrollBarv.setDisable(true);  and set the opacity to 0 in the css file:
    //css file
    .text-area .scroll-bar:vertical:disabled {
        -fx-opacity: 0;
    }Here is an example:
    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.ContextMenu;
    import javafx.scene.control.MenuItem;
    import javafx.scene.control.ScrollBar;
    import javafx.scene.control.TextArea;
    import javafx.scene.input.ContextMenuEvent;
    import javafx.scene.layout.StackPane;
    import javafx.stage.Stage;
    public class TextAreaSample extends Application {
        @Override
        public void start(Stage primaryStage) {
        final TextArea textArea = new TextArea();
            textArea.setWrapText(true);
            StackPane root = new StackPane();
            root.getChildren().add(textArea);
            Scene scene = new Scene(root, 300, 250);
            primaryStage.setScene(scene);
            primaryStage.show();
            scene.getStylesheets().add(getClass().getResource("style.css").toExternalForm());
            ScrollBar scrollBarv = (ScrollBar)textArea.lookup(".scroll-bar:vertical");
            scrollBarv.setDisable(true);
        public static void main(String[] args) {
            launch(args);
    }

  • How to add scroll bar in child form ( vb6.0 )

    look at this picture link (i think you will understand the issue)
    http://tinypic.com/r/25k232u/8
    These information(class1,class2 ……) are loaded from database and this time the information is too much and it moves down to the appearing part of the window and unable to view these items
    How to add scroll bar in visual basic child form so that the data items can be viewed by scroll in case it go beyond the screen.

    Hi,
    Welcome to MSDN.
    I am afraid that these forums donot support VB6 any more, you could refer to this thread:
    Where to post your VB 6 questions
    You could consider posting this issue in these forums below:
    These forums do not support Visual Basic 6, however there are many third-party support sites that do. If you have a VB6-related question please visit these popular forums:
    VB Forums
    VB City
    Thanks for your understanding.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to add scroll bar within af:showDetail

    I have added a af:panelGroupLayout to af:showDetail, and set the "layout" property of the panel group layout out to "scroll". However, the scroll bar still does not show up within af:showDetail. If I set the height for the panel group layout within af:showDetail, then the scroll bar shows. But then it will not stretch vertically upon stretching the dialog vertically. Is it possible to add scroll bar within af:showDetail?
    Here's a sample code which I tried -
    <*af:panelStretchLayout* id="psl1">
    <f:facet name="center">
    <*af:showDetail* disclosed="false" id="sd1" disclosedText="Metadata"
    undisclosedText="Metadata">
    <*af:panelGroupLayout* id="pgl2"
    inlineStyle="background-color:White;"
    layout="*scroll*">
    </panelGroupLayout>
    </af:showDetail>
    </f:facet>
    </af:panelStretchLayout>

    Yes, you can try panelStretchLayout as well.
    Copy following fragment into an empty <af:document> to see the difference.
    <af:form id="f1">
    <af:showDetail disclosed="true" id="sd1">
    <af:panelStretchLayout id="psl1">
    <f:facet name="bottom"/>
    <f:facet name="center">
    <af:panelGroupLayout id="pgl1" layout="scroll">
    <af:outputFormatted value="outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>"
    id="of1"/>
    </af:panelGroupLayout>
    </f:facet>
    <f:facet name="start"/>
    <f:facet name="end"/>
    <f:facet name="top"/>
    </af:panelStretchLayout>
    </af:showDetail>
    <af:showDetail disclosed="true" id="sd2">
    <af:panelGroupLayout id="pgl2" layout="scroll">
    <af:outputFormatted value="outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>outputFormat1&lt;p>"
    id="of2"/>
    </af:panelGroupLayout>
    </af:showDetail>
    </af:form>
    Enjoy ADF...
    Todd

  • How to add scroll bar to a labview wave graph?

    I want to know if there is a to add scroll bar to a labview wave graph.

    Look here:
    http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=5065000000080000001E400000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0

  • How to add scroll bar in webi table

    Hi Experts,
    Currently i am working on webi report it consist lot of tables and charts. As per my requirement the webi table should contain scroll bar instead of showing all data in single shot. And user will scroll down  if he/she required.  Is it possible in webi?
    Regards,
    PRK.

    Hi Praveen,
    Adding scroll ball in Webi table is not possible currently.
    Requests has been raised by some people in SAP Idea place, see the link below for more details.
    You can vote in SAP Idea place for getting this feature
    Add scroll bars for Webi tables : View Idea

  • Any Possible to add Scroll Bars to SysLink Control in MFC

    If there is any chance to add Scroll Bars to SysLink Control in VC++ MFC Application?

    Hi J Sathish Kumar,
    CLinkCtrl class derive form CWnd class, so it can create with the common windows style WS_VSCROLL. So we could create a syslink control with this style.
    https://msdn.microsoft.com/en-us/library/xw25kwch.aspx
    PTCHAR url =
    _T("Link 2) ")
    _T("<A HREF=\"http://msdn2.microsoft.com/en-us/visualc/default.aspx\">")
    _T("Microsoft VC++ Home")
    _T("</A>");
    //m_mylink is a object of a class derive from CLinkCtrl class.
    m_mylink.Create(url,
    (WS_VISIBLE | WS_TABSTOP | WS_CHILD | WS_BORDER|WS_VSCROLL),
    CRect(
    100, 100,
    400, 240),
    this,
    IDC_SYSLINK2);
    You need to create a class derive form CLinkCtrl class. And you will find the scrollbar cannnot scroll. Here is a workaround:
    LRESULT CMyLinkCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
    // TODO: Add your specialized code here and/or call the base class
    if (message == WM_NCHITTEST || message == WM_NCLBUTTONDOWN || message == WM_NCLBUTTONDBLCLK)
    return ::DefWindowProc(m_hWnd, message, wParam, lParam);
    return CLinkCtrl::WindowProc(message, wParam, lParam);
    Set the scrollbar information.
    int CMyLinkCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
    if (CLinkCtrl::OnCreate(lpCreateStruct) == -1)
    return -1;
    // TODO: Add your specialized creation code here
    SCROLLINFO vinfo;
    vinfo.cbSize = sizeof(vinfo);
    vinfo.fMask = SIF_ALL;
    vinfo.nPage = 30
    vinfo.nMax = 140
    vinfo.nMin=0;
    vinfo.nTrackPos = 0;
    SetScrollInfo(SB_VERT, &vinfo);//
    return 0;
    Handle the WM_VSCROLL message event in your new class CMyLinkCtrl.
    void CMyLinkCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
    // TODO: Add your message handler code here and/or call default
    SCROLLINFO scrollinfo;
    GetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL);
    switch (nSBCode) {
    case SB_BOTTOM:
    ScrollWindow(0, (scrollinfo.nPos - scrollinfo.nMax) * 10); scrollinfo.nPos = scrollinfo.nMax;
    SetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL); break;
    case SB_TOP: ScrollWindow(0, (scrollinfo.nPos - scrollinfo.nMin) * 10); scrollinfo.nPos = scrollinfo.nMin;
    SetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL);
    break;
    case SB_LINEUP:
    scrollinfo.nPos -= 1;
    if (scrollinfo.nPos<scrollinfo.nMin) {
    scrollinfo.nPos = scrollinfo.nMin;
    break;
    SetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL);
    ScrollWindow(0, 10);
    break;
    case SB_LINEDOWN:
    scrollinfo.nPos += 1;
    if (scrollinfo.nPos>scrollinfo.nMax) {
    scrollinfo.nPos = scrollinfo.nMax; break;
    SetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL); ScrollWindow(0, -10);
    break;
    case SB_PAGEUP:
    scrollinfo.nPos -= 5;
    if (scrollinfo.nPos<scrollinfo.nMin) {
    scrollinfo.nPos = scrollinfo.nMin;
    break;
    SetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL); ScrollWindow(0, 10 * 5);
    break;
    case SB_PAGEDOWN:
    scrollinfo.nPos += 5;
    if (scrollinfo.nPos>scrollinfo.nMax) {
    scrollinfo.nPos = scrollinfo.nMax;
    break;
    SetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL); ScrollWindow(0, -10 * 5);
    break;
    case SB_ENDSCROLL:
    break;
    case SB_THUMBPOSITION:
    // ScrollWindow(0,(scrollinfo.nPos-nPos)*10); // scrollinfo.nPos = nPos;
    // SetScrollInfo(SB_VERT,&scrollinfo,SIF_ALL);
    break;
    case SB_THUMBTRACK:
    ScrollWindow(0, (scrollinfo.nPos - nPos) * 10);
    scrollinfo.nPos = nPos;
    SetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL);
    break;
    CLinkCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
    Above code is just for test and help you understand how to add the scrollbar, you could make it more suitable for your situation. Hope this helps some. Example Screenshot:
    Best regards,
    Shu
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to add scroll bars to a panel

    Hi
    Can anyone plz tell me how to add a scroll bar to a panel created within a JFrame
    Regards
    ats

    import javax.swing.*;
    import java.awt.*;
    class Testing extends JFrame
      public Testing()
        setLocation(300,200);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        JPanel jp = new JPanel();
        jp.add(new JLabel("Label on a panel"));
        jp.setPreferredSize(new Dimension(200,300));
        JScrollPane sp = new JScrollPane(jp);
        sp.setPreferredSize(new Dimension(200,200));
        getContentPane().add(sp);
        pack();
      public static void main(String args[]){new Testing().setVisible(true);}
    }

  • How to add scroll bar to JDesktopPane?

    Hi All,
         After download the "InternalFrameDemo.java" from the swing tutorial, I want to add scrollbars to JDesktopPane so that whenever a internal frame moves off the desktop view port, a scrollbar will display. I have tried many ways to implement this but no success.
    Do you know how to add scrollbars to JDesktopPane?
    Thanks
    Anson

    You can't get there from here! Assuming that wou want is to make the desktop scrollable that is.
    The trick to make somthing scrollable is to make JScrollPane CONTAIN the component to be scrolled. If you could ask the desktop to return the component it contains, you might have a chance but no luck, the desktop pane actually inherits a layered pane which is most likey is what you would like JScrollPane to contain.
    Now here's another angle to this story... the desktop is complex enough without scrollbars, why would you want to complicate things by adding a scroll bar anyway? Say one of its window is maximized and has a scrollbar of its own AND the desktop has one.... that makes TWO scroll bars side by side. Talk about confusing.
    I believe the desktop was designed so scroll bars can't be added for a very good reason: good UI practises.

  • Add Scroll Bars around Large JPG Image - JDev 11.1.2

    Hello:
    I have a panel tabbed componet and inside one of the show detail items, I would like to put a rather large image. I can put the af:image into the show detail item, but neither horizontal or vertal scroll bars appear, so I can only see the upper left corner of the JPG image. How can I make horizontal and vertical scroll bars appear around the image?
    Thanks for the help.

    Try to put the image into a panelGroupLayout in scroll mode...
    Timo

  • How can I add scroll bars to a textarea and setfocus at the end of the box.

    I didn't see a scrollbar option so I was wondering how would I add one? Also how can I setfocus to the last line in the textarea?

    You have to create a JScrollPane that will enclose the TextArea as in new JScrollPane (yourTextArea).
    You can setFocus to any Component and you can position the caret in an TextArea.
    Regards
    SH

  • TextArea horizontal scroll bar?

    Is it possible to have horizontal scroll bars in TextAreas? In html, the horizontal and vertical scroll bars automatically render themselves when needed. But that is not happening with the TextArea dropped on the design page from Creator's JSF Standard Components palette. Is there a setting somewhere to make the horizontal scroll bar show?

    Hi,
    This problem has been noticed earlier too and a bug exists for the same. In the meanwhile the following workaround is available which has been suggested by one of the engineers:
    1. Add a "div" tag enclosing "select" tag.
    2. Move the style attribute from "select" tag on "div" tag
    3. In addition, add an "overflow" attribute to "style" attribute on "div" tag and set it to "auto".
    <div style="left: 168px; top: 96px; overflow: auto; position: absolute; height: 192px; width: 192px">
    <ui:listbox binding="#{newPage.listbox1}" id="listbox1" items="#{newPage.listbox1DefaultOptions.options}" />
    </div>
    Please be warned that once you do, your page will not render well in designer. So this should be done once the app has been rendered and is ready for deployment.
    Hope this helps
    Cheers
    Giri

  • How do I turn off the add-on bar so it doesn't turn itself back on?

    By right clicking on the menu I can turn on or off the various toolbars including the Add-on bar. But if I create a new tab or new window it turns on the add-on bar again. How can I turn it off so it does not reappear?

    I have extension McAfee SiteAdvisor. And yes if I disable it the troublesome add-on bar stops reappearing. But SiteAdvisor does useful things even without displaying the add-on bar.

  • Horizontal scroll bar at top in JScrollPane

    Hi,
    How can i get the horizontal scroll bar to be on the top instead of bottom
    here is my code
    TableModel tableModel = new TableModel(totalData,
    columnHeader);
    JTable table = new JTable(tableModel);
    JScrollPane scrollPane = new JScrollPane(table);
    Ashish

    Hi Ash
    I dont know whether this is feasible please sorry if i am wrong.
    Create a JPanel and add scroll bar to the left and top.
    I have posted a Q in the subject JDialog Esc Key. please answer the Q for me.
    Lakshmi.

  • Horizontal scroll bar in reportview in ssrs

    hi
    how can i add scroll bar in report even it has only 2 rows and columns...in a table...

    Hi Rajaprasad,
    According to your description, you want to add a scroll bar in ReportViewer control.
    In your scenario, you should specify the value of AsyncRendering as "true" and SizeToReportContent as "false" in ReportViewer Properties. Then you should open WebForm.aspx to add the code below:
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

Maybe you are looking for

  • IWeb '08 Damage Control

    Here's the full text from the MacFixIt post on iWeb '08. "iWeb '08 Calamity: Lost site content, crashes, significantly increased resource usage, more Backup your Domain files Make a copy of this file -- located in ~/Library/Application Support/iWeb/D

  • Load Balancing in Clustered Weblogic 12c

    Hi,    Weblogic.........: 12.1.3    OS..................: Oracle Enterprise Linux 6.3 We have configured a Clustered Weblogic (2 virtual servers) successfully. Now we are searching for some good Load Balancing solutions. I've tested a ProxyServlet, b

  • Help on USER EXIT for MIGO

    Hi friends, Facing problem in USER EXIT for MIGO... My requirement is... I want to give a error message for good issue or  it should not be posted in MIGO, if the Item OK check has not been made for all the available materials corresponding to Order

  • I cant type in my password.. need help asap.

    i got the ipod touch for christmas and it was working fine this morning but it died on me around 2 and when i went to plug it into the computer it kept showing the picture of the plug and itunes(like right before you plug it in for the first time). a

  • While playing a video in one window, an ad starts playing in another window and steps all over my video.

    I usually have multiple windows open and if I am watching a video in one window and an advertisement starts in another window it steps on my video.