Results 1 to 6 of 6
  1. #1
    lala is offline Member
    Join Date
    Oct 2010
    Posts
    80
    Rep Power
    0

    Default Cursor does not move to end of statement

    Hi.
    Java Code:
    System.out.print("Enter feet: ");
    	feet = console.nextInt();
    	System.out.println();
    	System.out.print("Enter inches: ");
    	inches = console.nextInt();
    	System.out.println();
    prompt line: Enter feet:

    I want the cursor to position after the colon, but it does not. It positions before the Enter feet: statement.
    Any ideas why?
    Thanks In Advance

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,655
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by lala View Post
    Hi.
    Java Code:
    System.out.print("Enter feet: ");
    	feet = console.nextInt();
    	System.out.println();
    	System.out.print("Enter inches: ");
    	inches = console.nextInt();
    	System.out.println();
    prompt line: Enter feet:

    I want the cursor to position after the colon, but it does not. It positions before the Enter feet: statement.
    Any ideas why?
    Thanks In Advance
    Does that happen in a console (shell) or does it happen in a window created by some IDE (NetBeans, Eclipse etc.)?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    lala is offline Member
    Join Date
    Oct 2010
    Posts
    80
    Rep Power
    0

    Default Cursor does not move to end of statement

    Heyyy JosAH. Thanks for respsonding.

    OS: Vista sp2 on Mac Boot Camp
    Browser: IE7
    IDE: Created in a window Eclipse 3.4.1

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,655
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by lala View Post
    Heyyy JosAH. Thanks for respsonding.

    OS: Vista sp2 on Mac Boot Camp
    Browser: IE7
    IDE: Created in a window Eclipse 3.4.1
    I don´t know what a brower has got to do with it but yes, Eclipse does that; note that the moment you start typing the characters end up at the correct position (after the prompt here); don't pay too much attention to it.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default

    The console class is nasty - It has been nothing but trouble with the apps I've seen that use it. It has different behavior from platform to platform and often has issues like those you describe. I still do it the old fashioned way, works wonderfully every time:
    Java Code:
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String line = in.readLine();

  6. #6
    lala is offline Member
    Join Date
    Oct 2010
    Posts
    80
    Rep Power
    0

    Default Cursor does not move to end of statement

    Thanks Jos and quad64bit. Quad, i'm gonna try your suggestion.

    Thanks again,
    lala

Similar Threads

  1. Show Cursor
    By PhQ in forum AWT / Swing
    Replies: 3
    Last Post: 09-01-2010, 08:23 PM
  2. Replies: 4
    Last Post: 06-27-2010, 06:03 PM
  3. change the mouse cursor - crosshair cursor
    By cassysumandak in forum New To Java
    Replies: 1
    Last Post: 09-28-2009, 01:57 AM
  4. Cursor
    By serfster in forum New To Java
    Replies: 2
    Last Post: 06-15-2008, 05:49 AM
  5. Using a cursor
    By notnumber6 in forum New To Java
    Replies: 3
    Last Post: 11-26-2007, 10:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •