Getting immediate character behind to the cursor in JTextPane?

when i use left arrow, i am not getting the immediate character behind to the cursor, but i am getting the character after 2 position in JTextPane. It works fine for the right arrow. since we get the character based on the caretposition. how can i get immediate character behind to the cursor when i use other arrow's other than right arrow?
thnx in advance

Swing related questions should be posted in the Swing fourm.
The simple answer would be to use getCaretPosition -1. But this is probably not what you are looking for and you question is not very detailed.
So, posting a simple 10 line executable demo program would be nice. Its probably a problem with the order of events.

Similar Messages

  • Sometimes when I open my laptop back from sleep, I get a black screen with the cursor showing.

    Recently I've been getting this weird problem where my macbook air will show a black screen with only the cursor visible that I can move around but nothing else can be done to get to the desktop. The only way is to close the lid and wait for around 10 or more seconds and then open the lid again to bring the laptop back from sleep and hope that the laptop goes to the lock screen and then to the desktop. This works often but sometimes the only solution seems to be to restart the laptop. This also happens when I tilt the lid to the point where it is almost closed and when I tilt it back the screen presents the above state. Theis has been happening often now and it is almost impossible for the above not to happen atleast 2 to 3 times a day. iThis is a relatively new problem that has been occuring since the past two weeks or so and never happened to me on my Macbook Pro 15 2011. My current system is a Macbook Air 11" 2013 Haswell 1.3 Ghz 4GB RAM 256 GB SSD. Now I dont want to have to send in my laptop if I dont have to if there is a way I can solve this myself. Anybody else have this problem?

    Hello tseten,
    I would be concerned too if my MacBook Air was not waking from sleep appropriately.  For an issue like this, I recommend resetting your System Management Controller (SMC) and NVRAM.
    Resetting the SMC on portables with a battery you should not remove on your own
    Note: Portable computers that have a battery you should not remove on your own include MacBook Pro (Early 2009) and later, all models of MacBook Air, and MacBook (Late 2009).
    Shut down the computer.
    Plug in the MagSafe power adapter to a power source, connecting it to the Mac if its not already connected.
    On the built-in keyboard, press the (left side) Shift-Control-Option keys and the power button at the same time.
    Release all the keys and the power button at the same time.
    Press the power button to turn on the computer. 
    Note: The LED on the MagSafe power adapter may change states or temporarily turn off when you reset the SMC.
    You can find the full article here:
    Intel-based Macs: Resetting the System Management Controller (SMC)
    http://support.apple.com/kb/ht3964http://support.apple.com/kb/ht3964
    Resetting NVRAM / PRAM
    Shut down your Mac.
    Locate the following keys on the keyboard: Command (⌘), Option, P, and R. You will need to hold these keys down simultaneously in step 4.
    Turn on the computer.
    Press and hold the Command-Option-P-R keys before the gray screen appears.
    Hold the keys down until the computer restarts and you hear the startup sound for the second time.
    Release the keys.
    You can find the full article here:
    About NVRAM and PRAM
    http://support.apple.com/kb/ht1379
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • How do I get an image to follow the cursor on an applet?

    I'm trying to create a applet which has a bullseye on it and when the cursor moves across it the image(bullseye) follows it but I have no idea how to do this. I know I have to use the mouseMoved event. Also how do I have a JPanel covered by a image? Please help.

    Actually, have a look at the Toolkit.createCustomCursor() method. It'll do it for you. I got it to work using:
    Image image;
    try {
        image = Toolkit.getDefaultToolkit().createImage("cursor.gif");
        Cursor c = Toolkit.getDefaultToolkit().createCustomCursor(image, new Point(0,0), "my cursor");
        setCursor(c);
    catch (Exception e) {
        e.printStackTrace();
        return;
    }

  • Can we get a character limit for the subject line?

    Some of the more annoying posts place the entire story in the subject line.
    (e.g. http://forums.ni.com/ni/board/message?board.id=170​&thread.id=334536&jump=true)
    The problem is that the edit window when replying blows the margins, making it wider than the screen.
    I would think that e.g. a 132 character limit would be sufficient for titles. If anything posted from the newsgroup exceeds that, it could be truncated.
    LabVIEW Champion . Do more with less code and in less time .

    I agree with Christian,
    It seems that some people want to describe the entire issue in the title instead of providing a synopsis..

  • L need help with textedit, I inserted a picture then the cursor went from small to the size of picture and l need to write a header next to the picture not at the bottom of it. can anyone help please?

    Can anyone tell me how to make cursor smaller after inserting picture so that l can add somethimg right next to it instead of bottom of picture. Meaning the next line is too low

    AFAIK, you can't. The nature of TextEdit is that it allows the picture to be treated as a character and adjusts the cursor size for that line.
    You need a app that supports transparent overlays.

  • Robot class and positioning the cursor

    I have an application where I have a number of panels on the screen and using an editable field wish to enter coordinates to position the Cursor to on another panel.
    ie, using grid coordinates on a map. Using the robot class I am able to position the cursor on the other panel but as soon as I move the mouse the cursor jumps back to the original position on the screen where the first panel with the editable field was. It is like only a picture of the cursor was drawn at the new coordinates and the real cursor is still at the old podition. It is important to this application that if the cursor is moved it stays where it has been moved to and actually is there and not just appearing to be there. I am using jdk 1.3 on Intel Solaris 2.8. Any help on this issue would be helpful and appreciated

    Maybe you can use the mouse move event to position the mouse to where you had moved the cursor to.
    for example
    1.the mouse is at point 100,100
    2. you move the cursor from your code to point 0,0
    3. the user starts to move the mouse
    4. you code gets that event and repositions the cursor to the last place where it was, that is at 0,0

  • Resize items depending on how near the cursor is

    OK...basically I have a scrolling thumbnail panel. I was
    wondering, if it's possible to make this so that images get larger
    as you move the cursor towards them, mac dock style. I can make it
    so that a movie runs to make an object grow as you hover over it,
    but this is simply to do with whether or not you are hovering over
    it, rather than how near the image's centre you are.
    I want to create the mac dock style effect! Can anyone help?
    Thanks

    ok thanks, but what action script do i need to detect the
    mouse position?
    thanks fo your help

  • Where is the cursor?

    if you do a
    BufferedImage screenshot = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
    you will get a screenshot, but without the cursor. Is it possible to also have the cursor on the screenshot?
    Thank you!!

    referr: http://forums.adobe.com/thread/452365?tstart=30
    <script language="JavaScript" type="text/javascript">
    function setFocusToTextInput()
        document.getElementById('${application}').focus();
    <!--
    // Globals
    // Major version of Flash required
    var requiredMajorVersion = ${version_major};
    // Minor version of Flash required
    var requiredMinorVersion = ${version_minor};
    // Minor version of Flash required
    var requiredRevision = ${version_revision};
    // -->
    </script>
    on creationcomplete event call
    init(event);
    public function init(event:Event):void
        ExternalInterface.call('setFocusToTextInput');
        this.username.setFocus();

  • Applescript to get the current insertion point of the cursor

    How do I use Applescript to get the current insertion point of the cursor in a Apple pages.app document?

    Oops, missed that one - you are correct, the line should be:
    <pre title="this text can be pasted into the Script Editor" style="font-family: Monaco, 'Courier New', Courier, monospace; font-size: 10px; padding: 5px; width: 720px; color: #000000; background-color: #E0E0E0; overflow: auto">set {TheStart, TheEnd} to character range of the selection</pre>
    I have a wrapper script that I use to insert stuff from my handler/code library into a Script Editor document, and was adapting snippets from that for my examples - I guess that one got away.
    As for the dictionary, some applications just have poorly written or outdated documentation. Some of the items have multiple entries (eg, there may be a selection object for the application and also for the document), and some inherit properties from other items. Some are used as nouns, others as verbs (or both). Sometimes it is easier to visualize the item by keeping track of it's reference - the 'some property of document 1 of the current application' thing. You can use the Script Editor's Event Log to see the results of various properties and commands - for example, the above script will result in the following entry (your numbers will vary depending on the selected text):
    <pre title="this text can be pasted into the Script Editor" style="font-family: Monaco, 'Courier New', Courier, monospace; font-size: 10px; padding: 5px; width: 720px; color: #000000; background-color: #E0E0E0; overflow: auto">tell current application
    get character range of selection
    {50, 50}
    end tell
    </pre>
    You can also use the 'log' statement (eg, 'log MyVariable') to add your own entries into the log instead of using dialog boxes.

  • [IDCS5.5 plugin] How do I get the sentence at the cursor's position?

    Hi All,
    How can I get the current cursor position (event on mouse left-click)?
    And then , how can I fetch the sentence based on the cursor's position? (Assuming a sentence starts with a capital character and ends with a ".")
    I'm getting no hint on this, any help will be appretitated.
    Thanks

    tma654 wrote:
    Sorry, not so good great at LR.  Do you have pics or something visual to show how this is done?...Do i have to switch each photo's process version or is there a way to do a whole batch of them?
    The quickest way to update just one photo is to click the lightning bolt icon under the histogram in the Develop module. This can be more convenient than scrolling all the way down to the Calibration tab.
    A quick way to update a whole batch of them is to select any number of them in Grid view, and then choose Photo > Develop Settings > Convert to Current Process. The AutoSync way works too, as long as you remember to turn it off immediately after you're done.
    Like JimHess suggests, I don't automatically convert them all at once, but on a case by case basis because they don't always look better after conversion. The benefits of the new process version can potentially make them look better, but you usually have to do a few more adjustments to get them there. If you don't have time to do that yet but you need to use the existing images soon, leave them in the old process version for now.

  • I am getting frequent lock-ups and blue screens during boot up. The lock ups occur during normal use and I cannot click anything or force quit. The cursor shows something is loading, but never stops. I have to use power button. Ideas?

    I am getting frequent lock-ups and blue screens during boot up on my Mac Pro.  The lock- ups occur sometimes during normal use and I cannot click anything or force quit. The cursor shows something is loading, but never stops. I have to use power button.
    I had the Mac Defender malware and I have used apple jack but still having issues.

    I am getting frequent lock-ups and blue screens during boot up on my Mac Pro.  The lock- ups occur sometimes during normal use and I cannot click anything or force quit. The cursor shows something is loading, but never stops. I have to use power button.
    I had the Mac Defender malware and I have used apple jack but still having issues.

  • On startup Mac Pro I get a blue screen and a cursor on the upper left. The mouse cursor shows up independently. Is it likely a video card failure?

    On startup Mac Pro I get a blue screen and a cursor on the upper left. The mouse cursor shows up independently. Is it likely a video card failure?

    I managed to boot the computer and get the desktop to show. I now have a "repaired" computer. There are several problems that have cropped up. One is that I can only start up now in Safe Boot mode. Is there a way to turn it off? Also, I do not have a sound list, so I can't access anything requiring audio. Google Chrome only shows up as a white screen. Pictures that loaded before don't load in browsers, etc. Any suggestions? I figure I should reinstall Mac OS Lion for starts, maybe even do a mirror backup and reformat the drive. I think this drive has turned into scrambled eggs...what a headache!

  • How can I get the cursor value from a waveform graph

     Is there a way to get the value of cursor position on the waveform graph so mathematical calculations be performed on those values. We can see the value in cursor legend, but can we extract those values for future calculations in the block diagram somehow.

    Right-click on the waveform graph icon.  Select Create>Property Node>Cursor>Cursor Position.  That spits out a a xy cluster for the current cursor position.
    If you have more than one cursor, you can either set up a loop and set the Active Cursor property node (right click the property node and select "Change to Write") or you can pull everything you ever wanted to know about every cursor with the Cursor List property node. 

  • PS CS5 Extended on Windows -  When trying to use the clone stamp and/or healing brush as soon as I move the cursor over the image I get an exact copy of the existing layer that moves around the window with the movement of the clone stamp/healing brush.  W

    PS CS5 Extended on Windows
    When trying to use the clone stamp and/or healing brush as soon as I move the cursor from the toolbar over to the image I get an exact copy of the existing layer that moves around the window with the movement of the clone stamp/healing brush.  This just started tonight.  What's causing this weird behaviour?

    What are the settings in Window > Clone Source?

  • I cannot get the info bar (not the dock) on the top of my screen to permanently appear without my having to put the cursor on top of screen. Then it appears. Don't even know what that is called...above the open window.

    How do I get the area above the open window to display information (as in closing that specific window, "Safari  File Edit View History, etc.) without having to attempt to put the cursor on it to give me that info? I am not referring to the dock which is at the bottom of my screen. Although,It too, is not  visible.
    They were both visible before today.
    Sorry, but I have no clue as to what this topic should be.

    When you do Safari to it's maximum size on the screen (with the two little arrows in the Safari top menu bar on the right), Safari will take the whole screen including the top Apple menubar. In that menubar is the same set of little arrows to bring Safari back to it's previous size (which you can set by moving it's borders), you bring the Apple menubar in sight by moving the mousepointer to the top of the screen, when you do not want to loose that apple menubar, you can set Safari as bog as you can by moving its borders but just until below the apple menubar. Don't touch the little arrows in Safari menubar.

Maybe you are looking for