Using JScrollBar with JTextArea

hey!
i'm using JDev 10g, creating a Swing Application
i have a JTextArea and a JScrollBar (both which I have dragged down from Component Palette)
how to I use JScrollBar with the JTextArea, such that the JScrollBar response to the JTextArea
help me out...
Cheers,
Shivek

this is the problem:
i have a JTextArea and a JScrollBar which I have "DRAGGED" down from the component pallette in JDev...
how do I make the JScrollBar work for the JTextArea... because right now the JTextArea is not responsing to the JScrollBar...
so when the text is flooded in the JTextArea, scrolling the JScrollBar doesnt work
this is my code:
private JTextArea jTextArea1 = new JTextArea();
private JScrollBar jScrollBar1 = new JScrollBar();
private void jbInit() throws Exception
this.getContentPane().add(jScrollBar1, null);
this.getContentPane().add(jTextArea1, null);
can u tell me wat code is missing! I've tried everything... read many tutorials some of them uses a panel...
cheers,
Shivek

Similar Messages

  • Using mouseClicked with JTextArea

    Hi,
    I have a JTextArea, that has different entries, added on-the-fly, which dictate the appearance of a JPanel. To detect the user's selection I have added a mouseListener to the JTextArea, and in the body of the mouseClicked method have used the getPoint() method to access the position of the click. However, I was wondering if it is possible to convert this point to a more useful and readily understandable value - e.g. the line number of the JTextArea.
    Any help will be gratefully received,
    Yours truly,
    Master sifo-Dyas

    int position = textArea.viewToModel( point );
    Element root = textArea.getDocument().getDefaultRootElement();
    int currentLine = root.getElementIndex( position ) + 1;
    int currentColumn = position - root.getElement( currentLine ).getStartOffset() + 1;

  • Re: Using mouseClicked with JTextArea

    Thanks guys, you have both been a great help!!
    I now have the functionality I needed ...
    CHEERS
    a most grateful,
    Master sifo-Dyas

    int position = textArea.viewToModel( point );
    Element root = textArea.getDocument().getDefaultRootElement();
    int currentLine = root.getElementIndex( position ) + 1;
    int currentColumn = position - root.getElement( currentLine ).getStartOffset() + 1;

  • A problem with JTextArea.write()

    hi, I'm writting some code about reading content of a TextArea by use the method JTextArea.write().
    when the content is short, that will be ok, but the content is too long, my thread seems to be dead. and NetBeans's debuger shows nothing, just unresponse.
    can someone to point out my problem in the code below?
    textSource.write(bfw); //textSource is extends from JTextArea, when content in it is too large, dead here
    private void output2textResult() {
            Runnable myThread = new Runnable() {
                public void run() {
                    // component.doSomething();
                    final String source = txtFldSource.getText();
                    final String destination= txtFldDestination.getText();
                    String tmp;
                    try{
                        PipedWriter pipOut = new PipedWriter();                  
                        BufferedWriter bfw = new BufferedWriter(pipOut);   //I wrapped the pipOut with the BufferedWrite
                        PipedReader pipIn = new PipedReader(pipOut);
                        BufferedReader bfr= new BufferedReader(pipIn);
    //problem line below
                        textSource.write(bfw);   //textSource is extends from JTextArea, when content in it is too large, dead here  
                        while(bfr.ready()){
                            tmp = bfr.readLine();
                            tmp.replaceAll(source, destination);
                            textResult.append(tmp+"\n");
                        bfr.close();
                        pipIn.close();
                        pipOut.close();
                    }catch(IOException e){
                        System.out.println(e);
            SwingUtilities.invokeLater(myThread);

    This won't work. Pipes are for use between threads. The implication of what you're doing in a single thread is that the pipe is somehow capable of holding the entire source text (which it isn't). In other words you're just trying to buffer it, so you may as well just get all the source text as a String and do your magic on it directly.

  • Just double checking fonts with JTextArea

    Hi
    just want to double check something regarding JTextArea --- .
    I would like to programmatically enter text in the JTextArea display using different colored font.
    I was programmatically adding lines to the textarea using mytextarea.append(); and i noticed that the whole textarea content just flickered through all the different setFont calls .
    So I'm guessing the only solution is to programmatically determine the next insertion point and use the insert method to only set that piece of text -- is that the solution you guys came up with in that situation/
    stev

    Hi,
    the problem with it is, you do not read manuals. JTextArea is not for multi-fonts and multi-color text - is it for plain text, in one size, one font and one color. Use JTextPane with a DefaultStyledDocument in it. And please, do not ask, how to use it, before you have read the manual information for these classes.
    greetings Marsian

  • HT202667 Hi - My daughter was using her Apple TV until recently when she got a Smart TV.  Now the Apple TV is not needed so she passed it on to me.  How do I get it transferred over from her Home Sharing account to mine so that I can use it with my PC?

    Hi - My daughter was using her Apple TV until recently when she got a Smart TV.  Now the Apple TV is not needed so she passed it on to me.  How do I get her Home Sharing account transferred over to mine so that I can use it with my PC? Thanks!

    As  Winston Churchill wrote, however you might want to do a factory reset on the Apple TV.
    This way all information pertaining to your daughter will be removed from the device. Specifically if see was sign into any of the streaming service, Netflix, Hulu, etc. her credentials will still be associated with this Apple TV, doing  a factory reset will remove all that and make it as if you purchased the device and just plugged it in.
    regards

  • OPEN CURSOR using a WITH clause in the select query

    Hi,
    I am using Oracle 9i. I have a requirement where I have a REFCURSOR as an OUT parameter for my procedure. I have declared the TYPE and created the procedure.
    In the procedure, I am using OPEN <cursor_name> FOR <query>;
    Ideally this works in most of the cases that I have tried earlier. However, in the current case I am using a WITH clause in my query to get the results.
    I need help in understanding if the above mentioned syntax would not allow me to use the WITH clause in the query.

    What error do you get , seems to work ok for me on 10g
    SQL> begin
      2  open :cv for 'with x as (select * from emp)  select * from x';
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL> print :cv
         EMPNO
    ENAME
    JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7521
    WARD
    SALESMAN        7698 22-FEB-81       1250        500         30
          7566
    JONES
    MANAGER         7839 02-APR-81       2975                    20
         EMPNO

  • My iPhone 4 will not sync my new voice memos from the "Voice Memos" app to my computer. This is frustrating, should not be so hard, can someone please help. I use PC with windows 7 with iPhone version 6.1.3 and iTunes most recent. Thanks.

    My iPhone 4 will not sync my new voice memos from the "Voice Memos" app to my computer. This is frustrating, should not be so hard, can someone please help. I use PC with windows 7 with iPhone version 6.1.3 and iTunes most recent. Thanks.

    In the Music tab of iTunes, do you have 'Include Voice Memos' checked?

  • I ordered my Macbook Air with Aperture two years ago. I now have an iMac - can I use that with Aperture in any way?

    I ordered my Macbook Air with Aperture two years ago. I now have an iMac - can I use that with Aperture in any way? I appreciate that it is a different computer but I am now the end user of both devices and I was just wondering if it was possible.
    Thanks,
    Sean

    The answer would be in your software license agreement for Aperture. However if you cannot locate it you can ask in the Aperture forum, the link for that is:
    https://discussions.apple.com/community/professional_applications/aperture
    However I believe you can have Aperture installed on two machines however only one may be using it at a time.
    On the new iMac launch the Mac App Store - Purchased - look for Aperture and download to your new machine.

  • How do I use LDAP with iMQ 2.0?

    I am looking for an example to see how to use LDAP with iMQ 2.0.
    I was able to set up the config settings to access a local LDAP,
    but iMQ authentication still rejects valid logins.
    Let me know if I can find more info someplace.

    You can also find an example I put togther in the Sun One knowledge base.
    If you go here:
    http://knowledgebase.iplanet.com/NASApp/ikb/index.jsp
    Search for article 7772
    Alternatively here is the direct link
    http://knowledgebase.iplanet.com/ikb/kb/articles/7772.html

  • How do you use Struts with Jboss Portal

    I am trying to use strust with jboss portal but I am getting the following error:
    An error occured while rendering window 'default.MyPortlet2.myportlet2Window'
    org.apache.jasper.JasperException: Exception in JSP: /WEB-INF/jsp/SearchResultPage.jsp:71 68: List searchresult = (List) request.getAttribute("searchresult"); 69: %> 70: Stacktrace:
    I am getting this is in the log file
    Caused by: org.apache.jasper.JasperException: Exception in JSP: /WEB-INF/jsp/SearchResultPage.jsp:71
    68: List searchresult = (List) request.getAttribute("searchresult");
    69: %>
    70: <%
    71: for (Iterator itr=searchresult.iterator(); itr.hasNext(); )
    72: {
    73: testPackage.net.dao.hibernate.WorkList workList = (testPackage.net.dao.hibernate.WorkList)itr.next();
    74: %>
    Stacktrace:
    at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.jboss.portal.portlet.impl.jsr168.PortletRequestDispatcherImpl.execute(PortletRequestDispatcherImpl.ja
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.portal.server.servlet.CommandFilter.doFilter(CommandFilter.java:65)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
    at org.jboss.portal.portlet.impl.jsr168.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.ja
    ... 238 more
    Caused by: java.lang.NullPointerException
    at org.apache.jsp.WEB_002dINF.jsp.SearchResultPage_jsp._jspService(SearchResultPage_jsp.java:152)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
    ... 255 more

    I am trying to use strust with jboss portal but I am getting the following error:
    An error occured while rendering window 'default.MyPortlet2.myportlet2Window'
    org.apache.jasper.JasperException: Exception in JSP: /WEB-INF/jsp/SearchResultPage.jsp:71 68: List searchresult = (List) request.getAttribute("searchresult"); 69: %> 70: Stacktrace:
    I am getting this is in the log file
    Caused by: org.apache.jasper.JasperException: Exception in JSP: /WEB-INF/jsp/SearchResultPage.jsp:71
    68: List searchresult = (List) request.getAttribute("searchresult");
    69: %>
    70: <%
    71: for (Iterator itr=searchresult.iterator(); itr.hasNext(); )
    72: {
    73: testPackage.net.dao.hibernate.WorkList workList = (testPackage.net.dao.hibernate.WorkList)itr.next();
    74: %>
    Stacktrace:
    at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.jboss.portal.portlet.impl.jsr168.PortletRequestDispatcherImpl.execute(PortletRequestDispatcherImpl.ja
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.portal.server.servlet.CommandFilter.doFilter(CommandFilter.java:65)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
    at org.jboss.portal.portlet.impl.jsr168.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.ja
    ... 238 more
    Caused by: java.lang.NullPointerException
    at org.apache.jsp.WEB_002dINF.jsp.SearchResultPage_jsp._jspService(SearchResultPage_jsp.java:152)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
    ... 255 more

  • How do I use my apple bluetooth keyboard with touch and will I still be able to use it with my ipad?

    How do I use my apple bluetooth keyboard with touch and will I still be able to use it with my ipad?

    iPod touch User Guide (For iOS 4.3 Software)

  • How do I use user_datastore with a feeder proc to add an mdata section?

    Hi,
    I have text data spread across a number of different tables. I have created a user_datastore with a feeder procedure that creates an xml document which is then indexed into a dummy column on the parent table. This works fine. However I need to add an mdata section to the index, via my xml document. I haven't seen any examples of this being done in conjunction with the ctxsys.auto_section_group option of the create index statement, and am wondering if it is possible?
    Could somebody furnish me an example of how I achieve this.
    Oracle 11.2.
    Thanks
    Ralph

    You can't use MDATA with AUTO_SECTION_GROUP. AUTO means it automatically assigns zone sections for every tag it finds - if you want anything other than zone sections you must use BASIC_SECTION_GROUP, XML_SECTION_GROUP or HTML_SECTION_GROUP and manually define your sections.

  • I have a used Iphone with someone elses email on it for itunes, how do i remove it and put my account there

    I have a used Iphone with someone elses email on it for itunes, how do i remove it and put my account there
    It is an Iphone 4

    If you go to settings- store - click on the ID and sign out. Then you can put in your apple id.

  • Using Excel with Visual C++ 6.0 (need a graph control that behaves as much like the one in CVI as possible)

    I hate to beat this to death but I was unable to find a
    clear answer to this question.  Does NI provide Excel control from within
    Visual C++ 6.0? 
    I read that NI supports the ANSI-C library only for Visual C++ 6.0 users:
    Thread : "Re: Benifits of using measurment
    studio for VC++ 6.0?"
    NI REP : drohacek
    Quote  : "we made the decision to support Visual
    C++ 6.0 users only through the ANSI-C interface and not through the Measurement
    Studio MFC-based class libraries."
    If there is a suggested way of controlling Excel from within Measurement Studio
    for Visual C++ 6.0 then I’d love to know it. 
    If not, can a plain statement be made basically stating that if you want
    to control Excel you can’t use a Visual C++ 6.0 environment even with Measurement
    Studio support?
    With .NET of course you can just decide to have Excel support added during
    project creation.  CVI can act as an ActiveX server and easily control
    Excel just by building off the examples shipped with CVI.  I see that
    there is support, using the Measurement Studio for Visual C++ 6.0 Project Wizard,
    for taking existing CVI projects and converting them to Visual C++ 6.0 projects
    or for calling CVI libraries from a .dll from within Visual C++ 6.0.  I suppose I could do the work
    in CVI and then convert the project but I'm so deeply tied into all my MFC calls that I don't see
    how I can cleanly include the CVI libraries into my existing VC++ 6.0 projects.
    What I'm really after here is a visual graph control like the one in CVI that I
    can use from Visual C++ 6.0.  I purchased a 3rd party graph control for use
    in VC++ 6.0 that works well but isn't really visual.  I mean you can't
    enter any values in it until you run the program and fill it out programmatically. 
    Then you can see which columns are two narrow, quit the program, adjust the
    column width of your now empty control, and repeat, until you get the thing
    looking the way you want.  If I could call into Excel from within Visual
    C++ 6.0  the way I do from within .NET
    then I could use Excel to hold the table and just read in the values into my table
    control at run time.  Basically I'd use Excel as a visual development tool
    for all my tables.
    I do all my coding from within CVI and Measurement Studio for Visual C++
    6.0.  I'd use CVI for everything if I didn't depend so heavily on certain
    outside controlled C++ .dll's.  Could you please suggest then what I can
    do to get Excel support for Visual C++ 6.0?
    Last question :
    Is there any plan to ever have a NI table control like the CVI table control for
    use in Visual Studio?  One that you can
    completely set up before you do any compiling? 
    I imagine that the way Microsoft sets up their environment makes this idea impossible.  Otherwise someone would
    have come up with a truly “visual” table control before now.
    Thanks,
    Grant
    Grant M. Johnson
    Project Engineer
    LECO Corporation

    Hello Grant
    You can most certainly use Excel with VC++ 6.0. Measurement Studio won't provided you with any classes to talk to Excel in VC++ 6.0. This is because Excel allows control via Automation and you can use its automation API to do anything you need with Excel. This is what CVI uses as well.
    You can see this MSDN article on how to set this up. This mentions VC.NET, but it should work the same way.
    Here is one that talks about VC 6.0 and Excel.
    Here is a code project article about this.
    Even with .NET, you have to do thru the Excel Automation support. Excel started shipping with Primary Interop Assemblies (PIA) which are .NET wrappers about the Excel Automation object model. C++ Automation is definetely not as nice as .NET, BTW
    See this document for more information about the Excel object model.
    I would not recommend using the CVI Excel libraries if all you want to use them for is Excel automation. You will end up creating un-necessary dependencies and go through extra layers that way. You can make calls straight to Excel from VC++ without requiring CVI.
    One quick observation about your excel approach. If you decide to use Excel as your table, you might be requiring everyone who uses your application to have Excel installed on their machines. Just wanted to make sure this was acceptable to you.
    Have you looked at the Datagrid Activex control, which is one of the common controls that ships with Visual Studio? You can add it to Visual Studio by right-clicking and picking it from the list of installed activex control. If you have not already, you should check it out.
    Microsoft has made significant improvements in the number of controls they provide with .NET. They have a Datagrid control that seems to be what you need.
    Measurement Studio did add some high level classes for Excel and Word Automation that simplify some common tasks, but these exists for VS 2003 C++ and VS 2005 C++, not for VC 6.0. Underneath, we end up using the same Excel automation classes, so you can easily setup something similar for VC 6.0. Plus you can find alot of references online on how to use the Excel Automation object model with C++.
    We currently have no plans in Measurement Studio to create a table control unfortunately. I am assuming when you said graph, you actually meant table, since Measurement Studio already  provides a ActiveX graph controls for VC++ 6.0 that is very similar to the CVI graph.
    On a side note, VC++ 6.0 is really really old. Have you considered upgrading?
    To summarize
    - Yes, you can use Excel with Vc++ 6.0 without mstudio.
    - Try using the Datagrid Activex control if you just need a table.
    - Measurement Studio provides high-level excel and word classes for VC++ 6.0
    - Measurement Studio provides a graph control for VC++ 6.0 which is very similar to the CVI graph.
    - Measuremnt Studio does not have a table control.
    - VC++ 6.0 is really really old. Have you considered upgrading?
    Bilal Durrani
    NI

Maybe you are looking for

  • No Sound on External Monitor

    I have a MacBook Pro Retina (mid 2014) I just recently updated to Yosemite 10.10.2 Now I am not getting any sound to my external monitor using Mini DisplayPort..... picture looks great, just no sound (both were working fine). Using HDMI... everything

  • How to control screen ML81N

    Hi expert, -In ML81n, I know when we edit one Service Entry (SE) and move to the other SE within the PO, SAP system will not save the data. -But when we move from one SE from one PO to the other PO, SAP system will as for save before proceed. -So, my

  • Installing iDVD 8

    Just tried to install iDVD 7 three times. No prior installation of IDVD 6. iDVD 7 Appeared to install successfully, but won't launch either by clicking on the icon or clicking on open in a window. Other iLife programs will launch. What gives?

  • Hi! (iPhone4s) I have a problem with Mail.

    Hi all! I have a problem with Mail. I added my Gmail account. iPhone tells me that there are more than 42949670 mails. Obviously this number doesn't appear on the icon; I see it only when I open Mail. (Ah, I have already read all of these mails). The

  • Oracle Vm 3.1.1 install - why don't I have /OVS/seed_pool ?

    Hi Guys! I am learning Oracle VM 3.1.1. I have successfully set up one Virtual machine so far based on an i7 based "server' and Oracle VM manager 3.1.1. I used a templates from edelivery.oracle.com -- my server only supports PVM so the one I was able