Scrolling to a given line or offset  in a JTextPane   *Please Help*

I have looked on the web and do not see a solution to this problem. Maybee I am missing somthing very easy here.
I am using a JTextPane to display text of multiple colours.
The JTextPane is contained within a JScrollPane.
I am using a highlighter to highlight individual lines of text within this JTextPane.
However, the highlighted text may be outside of the viewport of the scrollPane and not be visible.
How do I scroll so that the highlighted line of code is visible????
I know you can scrollToVisibleRect. However how do I get the rectangle coordinates from a line of code, or from the highlighter.
Is it possibile and easy to scroll to make an offset or line number visible.????
So far I have tried:
setCaretPosition();
However this causes problems with highlighting.
Cheers
Andrew.

In the future, Swing related questions should be posted in the Swing forum.
So far I have tried:
setCaretPosition();
However this causes problems with highlighting.Makes no sense, setting the caret position has nothing to do with highlighting. Sounds like you have some other bug. Setting the caret position should work.
I know you can scrollToVisibleRect. However how do I get the
rectangle coordinates from a line of code, or from the highlighterAssuming you know the offset of the text you can use
textPane.modelToView(...)
to get the location of the text.

Similar Messages

  • How do I back up the music and apps etc. I restored my computer and I reinstalled iTunes, I was told something about a terminal command line, what does that mean? Please help

    How do I back up the music and apps etc. I restored my computer and I reinstalled iTunes, I was told something about a terminal command line, what does that mean? Please help

    - Transfer iTunes purchases to the computer by:
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer
    - Transfer any other music by using a third-party program like one of those discussed here:
    Copy music
    - Connect the iPod to the computer and make a backup by right clicking on the iPod under Devices in iTunes and select Back Up
    - Restore the iPod from that backup. The restore will also update the iOS.
    Note that the backup that iTunes makes does not include synced media like apps and music
    Are you sure you have a 3G iPod? A 1G iPod can only go to iOS 3.1.3
    See:
    Identifying iPod models

  • Can anyone knows how to fix back camera having pink lines when i use it so please help me  thank you

    can anyone knows how to fix back camera having pink lines when i use it so please help me  thank you
    <Email Edited by Host>

    You're welcome.
    The 6.1.4 update had nothing to do with this. If it did, then every iPhone with 6.1.4 installed would have the same problem.
    Apple doesn't support downgrading the firmware, which won't change anything.
    If an Apple Store is miles away, then call AppleCare.

  • My Apple ID is still disabled. How to fix it? I tried the steps given but just cant be solved. Please help.

    My Apple ID is still disabled. How to fix it? I tried the steps given but just cant be solved. Please help. i use right keyword but cant open apple id my

    Goldboyvidar wrote:
    how i can open my apple id?? 
    As the article states, you need to reset your password.
    how i can talk to apple center and i am deaf cant call them and them have not email???
    You can contact Apple Support online here
    or
    by phone: Apple Support Numbers

  • Screen has a vertical line that flickers sometimes... please help

    My screen suddenly had a vertical line that flickers (sometimes), it's green. I don't know how it got there and where did it come from. It just suddenly appear. I left my computer running (and at that time the line wasn't there) as I was waiting for an email to come through but when I got back to it, it had the line. I've restarted my computer but it was still there. What could be the problem and how to fix it? Please help. Thanks.

    Open up your OS Help Menu. In the search field type display.
    Search among the troubleshooting topics & click on the one(s) that pertain to your issue.
    If you have AppleCare you may wish to take advantage of same and/or Chat with a Support Agent. The online chat support is available 24 hours a day, 7 days a week.

  • I downloaded a app and when i started it up it froze and now has three lines going across the screen. Please Help

    My ipod touch isnt working. When I downloaded an app it froze up the screen and now it has three lines going across the screen please help me.

    Restore.

  • Line number in a *.class file, please help, advanced language guys

    dear all,
    i use c++ to open a *.class file and try to read line number of code in the file, i have 2 questions:
    1. i read line number in a method successfully, but i can not understand the meaning of start_pc, following are one of those data, please explain:
    s = start_pc,n = line_number
    s , n
    0 , 123
    8 , 125
    23 , 126
    29 , 127
    34 , 129
    38 , 130
    2. i can not find where the class's line number are, i.e. class start line and class end line, or field's line number.
    does these info exist inside a *.class file?
    thx for any light

    jdb gets line number of fields from class file, not
    source file definitely.I'm not really sure how you tested this, but here's my test, and JDB definitely gets its listing from the source file.
    First, I created and compiled class Tester:
    public class Tester
        public static void main( String[] argv )
        throws Exception
            Tester x = new Tester();
            System.out.println(x.toString());
        int     x;
        int     y;
        private Tester()
            x = 0;
            y = 1;
    }Then, I ran this in JDB. Note lines 16 and 17 in the output from "list":
    H:\Workspace>jdb Tester
    Initializing jdb ...
    stop in Tester.mainDeferring breakpoint Tester.main.
    It will be set after the class is loaded.
    runrun Tester
    Set uncaught java.lang.Throwable
    Set deferred uncaught java.lang.Throwable
    >
    VM Started: Set deferred breakpoint Tester.main
    Breakpoint hit: "thread=main", Tester.main(), line=12 bci=0
    12            Tester x = new Tester();
    main[1] list
    8    {
    9        public static void main( String[] argv )
    10        throws Exception
    11        {
    12 =>         Tester x = new Tester();
    13            System.out.println(x.toString());
    14        }
    15
    16        int     x;
    17        int     y;
    main[1] quit
    Tester@b82368Then I edited the source file. Again, look at lines 16 and 17:
    H:\Workspace>jdb Tester
    Initializing jdb ...
    stop in Tester.mainDeferring breakpoint Tester.main.
    It will be set after the class is loaded.
    runrun Tester
    Set uncaught java.lang.Throwable
    Set deferred uncaught java.lang.Throwable
    >
    VM Started: Set deferred breakpoint Tester.main
    Breakpoint hit: "thread=main", Tester.main(), line=12 bci=0
    12            Tester x = new Tester();
    main[1] list
    8    {
    9        public static void main( String[] argv )
    10        throws Exception
    11        {
    12 =>         Tester x = new Tester();
    13            System.out.println(x.toString());
    14        }
    15
    16        int     a;
    17        int     b;
    main[1]

  • Lines and Boxes in Pages. Please help!

    I created a poster in Pages and it is printing with all kinds of lines and boxes behind the text and images. When I go into the doc I do not see them there. Where is this coming from and how do I get rid of them?
    thank you!

    Thanks Jerry.
    Yes, I started with a Layout template. Yes, I did copy some text from Word - and this is some of the text with the problem so I will try deleting it and typing in the original text. But other parts that I am having problems with seems to be the previous boxes which were there as the template that I deleted - somehow their 'shadows' seem to still be there but only shows in print but not on my screen. If there is any other info I can provide to help you help me, please let me know!
    thanks again Jerry,
    Robyn

  • I am getting Render Filter error - Error in Symmetry initialization script: line 43: Variable name  expected. PLEASE HELP.

    Hi all,
    I have quit Creative Cloud. Checked for updates.
    Only activity that could have affected system files was to uninstall the CC apps, keeping the CC 2014 apps only.
    I need to use the render flame filter but I get the following error
    Error in Symmetry initialization script: line 43: Variable name expected
    I get this error with render tree and render frame.
    A response will be appreciated
    Thanks

    There is a "Symmetry Fill.jsx" script is Photoshop CC 2014 Preset Deco folder along with "Picture Frame.jsx" and "Tree.jsx" each of those scripts line 43 is a comment not executable code.  There are other scripts in that folder related the those rendering scripts could your folder have been corrupted somehow. I don't think uninstalling CC would have corrupted that folder for the doler fi not exist when CC was installed.
    Look at the line 43 in the files, Here is what I see on my Windows 7 Pro CC 2014 system

  • MySQl syntax error near " at line 1 and Unknown column. Please help

    Hello again,
    I have another question. Just to refresh I am using DWCS3 with MAMP on my MBP Leopard 10.5.6.
    I have created a form with the form wizard and a Transitional <!DOCTYPE>
    I have added the php validation code pages 481 to 485 The Essential Guide to Dreamweaver.
    I saved it and uploaded it to the testing server clicked the "insert form" button,and  I got;
    You have an error in your SQL syntax; Check the manual that corresponds to your MySQL server version for the right syntax to use near " at line 1
    The MySQL version I am using is 5.0.37. I have gone over and over the code and I can't find what is wrong with it.
    Also for the username column, I am now getting a message;
    'Unknown column'  'ella1' in 'where clause'
    I have researched it on the web and possible answers are that my columns are misspelled, the column doesn't exist or username is not in the query.
    I have checked all of these and I really can't see the problem, but there obviously is one.
    Please can someone help.
    Thanks again.
    P.S. I have attached the page in a .zip file if anyone wouldn't mind having a look.

    No, I'm talking about the dot before.
    Change this
    .$row_detailsRS[$details_prodID] . "";
    to this
    . $row_detailsRS[$details_prodID] . "";
    in both places.

  • When i slid my finger nothing happens. i have to tap somthing once and then the phone reads whatever button i tap and if i tap 2 times real fast it will open whatever i clicked on. i can not scroll the screen up or down.  can any one please help me?

    i have the tap every thing twice to activate it and i can not scroll .

    Quickly, triple tap the Home button to turn off accessibility features.

  • My scrolling bar/slider for songs is missing on my iphone please help

    I call it a scrolling bar but it is the slider that can search through the different time points in a song or podcast. I listen to podcast a lot so I use the 30second back button when i need to write information down that I have heard. I also like to search through the podcast later for information. I noticed that the slider over the song being played has disappeared about a week ago after a physical sync to my macbook. I have been using 3.0 since it was introduced with my last year's 3G iphone. I cannot find any options that might have disabled this feature any help would be appreciated. I even tried a reset and resync & I am still missing the slider.
    Any help would be appreciated.
    D

    I'm having similar problems with my iTouch. It seems to be random when it appears and disappears for use. Since I do a lot of audio books, its something I use a lot to reset back in time when the phone distracts me for a bit.
    I do notice it has happened a lot more since I've purchased a clock for docking and listening by the bed.

  • Getting weird symbols end the end of each line in Action script panel . Please help!!!!

    Let me know if anybody have got any clue to resolve this issue

    In the far upper right of the Actions panel is a small menu icon.  That includes the option for the menu-based route to turning the hidden characters on and off in case it ever happens again and you can't find this posting to help recall it.

  • Every time apple sends an update for my Itunes it goes wrong. last time this happened I got someone to fix it for me. I am very techno phobic and do not understand the on line instructions for uninstalling and reenstalling.Please help in simple English.

    when ever Apple sends an update to my pc, it knackers up my itunes. The last time this happened I got someone to fix the problem for me, I am very techno phobic and do not understand the uninstalling and reinstalling. It comes up error MSVCR80. Please can someone help in simple English , as the technical jargon just goes over my head.
    much Thanks

    The last time this happened I got someone to fix the problem for me, I am very techno phobic and do not understand the uninstalling and reinstalling.
    I think you should get a friend or family member who knows a bit more about computers to fix this for you.
    They should try the following instructions.
    Uninstall your existing copy of iTunes. Delete any copies of the iTunesSetup.exe (or iTunes64Setup.exe) installer files from your downloads areas for your web browsers and download a fresh copy of the iTunes installer from the Apple website:
    http://www.apple.com/itunes/download/
    (The current build of the 11.1.4.62 installer was changed a few days ago, which fixed the bulk of the reports of MSVCR80.dll/R6034/APSDaemon.exe/Error-7/AMDS-could-not-start trouble ... but the build number on the installer was not changed. So we're trying to make sure you do the reinstall using a "new good" 11.1.4.62 installer instead of an "old bad".)
    Does the install with the new copy of the installer go through properly? If so, does that clear up the error message?
    If you still have the same error messages cropping up, then try the procedures from the following user tip:
    Troubleshooting issues with iTunes for Windows updates

  • Given an iMac G5 with broken cpu. please help.

    My friend was loading onto the cpu and it blanked out. He is giving it to me and was the first owner. How do I fix this problem?
    Thank you in advance for any advice.

    Hello joy:
    Welcome to Apple discussions.
    Without further information, no one can even make an educated guess. You need to tell us what was being done, what happened, and so forth.
    Barry

Maybe you are looking for

  • Colors appearing different/darker compared to the color picker

    Everytime I select a color in Illustrator it has the "Out of gamut" warning and the color I want appears darker and different then how It looks in the preview of color picker. Does anyone know how I can fix this? It is making the colors of my design

  • UTL_HTTP end of body exception, sending soap message

    Hi there, I am using the utl_http to send a soap request, l _http_response := UTL_HTTP.get_response(l_http_request); UTL_HTTP.read_text(l_http_response, l_envelope); then UTL_HTTP.end_response(l_http_response);   l_response.doc := XMLTYPE.createxml(l

  • Workflow on confirmation is not routed to goods-receipient

    Hi Guys, We are implementing the shop on behalf (shop for) functionality. all functions are working fine , but we face a problem at the workflow for confirmation on goods&services. We ceate a SC with the Shop for functionality (user1 shops for user2)

  • Scrolling through zoomed in pages

    Wouldn't it make sense, when zoomed in, to give the arrow buttons the behaviour not to scroll to the next page, but to scroll to the next part of the zoomed in page. Now I am constantly struggeling with reading the second half of a page...

  • Guitar Rig, MBox interface with Logic

    I am using Guitar Rig with their foot pedal as input for my Guitar. I want to use my MBox for output control because the foot pedal only has a volume control which has to be manually manipulated and is inconvient to get at. I can see output in the Lo