Set cursor position in console

Hello,
I would like to set the position of the cursor in the console (command prompt).
Is ther a way to do this ?
public void printChar(int x, int y, char ch) {
     <set cursor position>(x,y);
         System.out.println(ch);
    }Thanks

Ymas wrote:
Do i have to add something like import java.???
No, nothing starting with "java.*" will help you. There is no way you can do that using only what Java provides itself, you will need to use external libraries.
Chances are, you don't want to do this right now and forget about it, just write one line after another.
If it s not too long could you write me the code for <*set cursor position*>(x,y);Find, download, learn to use JCurses or a similar library and write it. If that sounds like a lot of work for such a "simple" functionality then yes: that is a lot of work for such a little thing.
It's generally not worth doing.

Similar Messages

  • Setting Cursor position

    Pls help me for the following query:
    how to set cursor position at the beginning of text field(JTextField) after setting text inside it.

    RTFM
    http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/JTextComponent.html#setCaretPosition(int)

  • [ADF Faces] set cursor position to the first column input text in ADF table

    How do i set the cursor position to the first column input text when i Insert a blank row?
    My idea is to implement using javascript. document.setfocus() but how do i do it from the backing bean code? or how do i install custom js to call document.setfocus()?
    any ideas?
    Message was edited by:
    user450391

    Did you try by iterating the selected row?
    Bind the table with the managed bean and then try with below code:
    RichTable empTable;
    RowKeySet selectedEmps = getEmpTable().getSelectedRowKeys();   
    Iterator selectedEmpIter = selectedEmps.iterator();
    DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding empIter = bindings.findIteratorBinding("EmpView1Iterator");
    RowSetIterator empRSIter = empIter.getRowSetIterator();
    while(selectedEmpIter.hasNext()){
       Key key = (Key)((List)selectedEmpIter.next()).get(0);
       Row currentRow = empRSIter.getRow(key);
       System.out.println(currentRow.getAttribute("Ename"));

  • Problem when setting cursor position property

    I'm trying to use property nodes to set the cursor position programmatically, following an arrow keypress.  When my actual data file plotted, the position assignment doesn't work properly.  If I clear the data from the graph (right click, clear graph), then the cursor responds properly.  I've attached a zipped file with VI that demonstrates the problem.  Sorry the file is large--I had to include my data file to properly demonstrate the problem.
    Thanks for any advice that help me clear this up,
    Allan
    Solved!
    Go to Solution.
    Attachments:
    My Source Distribution.zip ‏541 KB

    bracker wrote:
    I'm trying to use property nodes to set the cursor position programmatically, following an arrow keypress.  When my actual data file plotted, the position assignment doesn't work properly.  If I clear the data from the graph (right click, clear graph), then the cursor responds properly.  I've attached a zipped file with VI that demonstrates the problem.  Sorry the file is large--I had to include my data file to properly demonstrate the problem.
    Thanks for any advice that help me clear this up,
    Allan
    Include this code in 'Initialize' state.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • Set cursor position

    Hi gurus,
        In the transaction COIB (creation of serialized assemblies).I need to do the following... Program name  (SAPLCOIB - Standard program in module pool)
          After i give the material no and serial no (in serialized assembly) by a barcode scanner, when i press enter i have to call EXPLODE in Application toolbar and my cursor position should come to serial no(in Assigned serialized components).
          After i give all the serial no by a bar code scanner i have to call TRANSFER button.
         After that my cursor should come to serial no ( in Serialized assembly).
       can you help me regarding this requirement....
      Urgent please...
    Thanks in Advance,
    Navaneeth.

    You can set the codes below :-
    1. SET CURSOR FIELD f.  ---> It will set the cursor at the begining of the field f
    You can use the additions :-  OFFSET off
                                               LINE   lin  (In step loop )
    Regards
    Srikanta Gope

  • Set cursor position within table control while scrolling

    hi,
    Anybody can guide me how to set the cursor with in table control while scrolling down,normally it is going to first input filed.
    Thanks and Regards,
    palani.

    Hi Palani,
    Could you please share with me what all you have done regarding get and set cursor. I am facing similar problem where
    I have made a Z Table Control where i have given vertical and horizontal scrolling . Now when I scroll and try to select a row, then ZTABLE_CONTROL-CURRENT_LINE fetches line number not from the top, it fetches from the current top of ztablecontrol.
    It is onlyy changing the value on scrolling, if i do not scroll table control then value is coming correct.
    My requirement is whenever i select any row of ZTABLE CONTROL i need to get the curent line number from top. Please guide me what should i do.
    Early reply will be rewarded.
    Thanks.

  • How to set Cursor position in ALV

    Hi,
    i have an issue that how can i set cursor in alv grid.
    i am using alv function modules.
    if user enters wrong info (i have one input enabled filed) then i must show this row as first row and place the cursor in that wrong entry column.
    does anybody worked on this kind of issue..?if so,plz send me the example code
    Thanks

    I think that you have to use OO ALV and use
    CALL METHOD <ref.var. to CL_GUI_ALV_GRID > ->set_current_cell_via_id
       EXPORTING
          IS_ROW_ID    =   <structure of type LVC_S_ROW > ( obsolete )
          IS_COLUMN_ID =   <structure of type LVC_S_COL >
          IS_ROW_NO    =   <structure of type LVC_S_ROID >.
    Hopefully, you can find the object reference of you REUSE ALV by using FM 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    (But i never try it)
    Regards.

  • How can I set cursor position inside TextInput or TextArea

    Hallo.. I can't find the way for changing che cursor position inside a String in the TextInput or TextArea Component.. I hope you can help me..
    Thx
    Max

    setSelection(index, index);

  • JTextArea: set cursor position

    Hello, i have a problem with my JTextArea: When I'm pressing Enter, the message in the JTextArea should vanish and the cursor should go back to his first position: first row, But the cursor jumps into the next row. These are the things I've tried as yet:
    area.setText(null);
    area.setText("");
    setCaretPosition(...);
    please, help me!
    THANKS

    If you must use a JTextArea, here is how: by overriding the JTextArea's processKeyEvent(...) method. In doing this, you intercept the key event before it is processed and the char gets written to the text area. This allows you to check the event so that if it is VK_ENTER (meaning the user hit the <enter> key), you can avoid writing it to the text area and, instead, call some method that writes the text to a socket (or whatever). Since the <enter> does not get written to the JTextArea, the cursor ends up back on the first line after you setText("").
    You will have to create your own class extending JTextArea and, in that class, override processKeyEvent(...). Some sample code is pasted below:
    import java.awt.event.KeyEvent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTextArea;
    import java.awt.BorderLayout;
    import java.awt.event.KeyEvent;
    import java.awt.Dimension;
    public class MyTextArea extends JTextArea {
         public MyTextArea() {
              this.setLineWrap(true);
         public void sendText(){
              //some code here to send text somewhere
              this.setText("");
         public void processKeyEvent(KeyEvent e){
              if(e.getKeyChar() == KeyEvent.VK_ENTER){
                   sendText();
              }else {
                   super.processKeyEvent(e);
         public static void main(String[] args) {
              Dimension d = new Dimension(200,100);
              MyTextArea textArea = new MyTextArea();
              textArea.setPreferredSize(d);
              JFrame frame = new JFrame();
              JPanel contentPane = (JPanel)frame.getContentPane();
              contentPane.add(textArea, BorderLayout.CENTER);
              frame.pack();
              frame.setVisible(true);
    }

  • How to get the cursor position from screen in module pool program

    Hi,
    I am doing the module pool program, I have one table control in one screen.
    I have to give functionality to the user that when the user enters first record in the table control and after filling the last field
    when he presses enter the cursor will have to come in the starting field of the second record.
    I know the logic , but i m bit confused.
    Can any body help me to solve this....
    thanks

    Hi,
    Check this code,
    Write it in the PBO
    MODULE SET_CURSOR_WERTKONTRAKT.
    MODULE SET_CURSOR_WERTKONTRAKT OUTPUT.
      PERFORM SET_CURSOR USING 'VBAP-ZWERT'.
    ENDMODULE.                 " SET_CURSOR_WERTKONTRAKT  OUTPUT
    FORM SET_CURSOR USING US_FELDNAME.
      DATA: DA_TFILL LIKE SY-TFILL.
      DESCRIBE TABLE IVBAP LINES DA_TFILL.
    FCODE 'Create Position':
    ==> Cursor to the first free line set to make the new position
    Can be created directly
        IF DA_TFILL EQ 0.
          SET CURSOR FIELD US_FELDNAME LINE 1.   -> set cursor position
        ELSE.
          SET CURSOR FIELD US_FELDNAME LINE 2.
        ENDIF.
    Product proposal actively
    Set ==> cursor in the first row
      IF DPP_ACTIVE   EQ CHARX AND
         XVBAP_UMFANG_OPV IS INITIAL.
    in the 'target volume' if available
        IF KOPGR_MIT_ZMENG CS TVAK-KOPGR.
            SET CURSOR FIELD 'VBAP-ZMENG' LINE 1.
            EXIT.
        ELSE.
    Else in the field 'Order quantity'
          SET CURSOR FIELD 'RV45A-KWMENG' LINE 1.
          EXIT.
        ENDIF.
      ENDIF.
    Hope it helps you,
    Regards,
    Abhijit G. Borkar

  • To handle cursor position in table control while using insert initial line

    hi,
          I have a requirement to handle cursor position in my table control in which i am using insert initial line by incrementing the index. Now i am handling the cursor position by using set cursor but after 14 records it is going to the first field of the screen. My table control length is 14 records.
          How to handle this, please reply me if anyone know.
    thanks & regards,
        sekhar.

    hi,
             I need to page down the page and then want to set cursor position but for this system command i am getting space for every command. Page down and cursor down or enter every thing it is taking as space. So for this how can i handle it.
    thanks & regards,
        sekhar.

  • Cursor position in alv grid

    Hi,
    How can control cursor posiotion in alv grid,
    plz help me.
    Regards,
    venkat.

    hiiii
    you can use SET or GET cursor statement of ABAP.that will help you to get cursor position & to set cursor position also
    regards
    twinkal

  • Back In One Frm To Prev Frm Than Than Set Cursor Postion

    Hi all
    In My Project One Problem Is Arising, me Run Project in Web ,
    Prob is When I run Project and Calling Form Main to Other From And Back To Main From than Cursor Position is Not Set ,
    So Any Function In Oracle Form To Set Cursor Position In Form.
    Help Me,
    Thanks

    hi role
    your ansid g8 and it working in simple application, but my appliation is run in the web and useing java applet , in that his is not working but in case i put any ack or message box in the when_window_active event and run . than it's working
    means
    start application and go main menu
    1 entry form
    2 add record
    3 display record
    choice "textbox"
    in text box i select any number into 3 and go this form but main form not exit, it nessacery, now i cloesd potion form and back to main form then cursor not set in text box , manuly click on text box .
    but i put message box in window_active event than is set
    so what is the prob i not understood
    help me

  • How to set a cursor position in OALV Reports

    Hi Experts,
    I have a created an OALV report and in the output field i've added drop down list with 2 values and for the drop downlist i've added  a Double click event.
    when i select a value from the drop down list and  double clicking the field the value beside the next field should be updated this is my requirement.
    But when i double clicking the field and coming back to the screen the cursor position is going to first position.
    i'm using REFRESH_TABLE_DISPLAY for to update my internal table.
    But i want the cursor positioned where i double clicked.
    so please help me.
    Regards,
    Rathan.

    Before
    CALL METHOD <ref.var. to CL_GUI_ALV_GRID>->refresh_table_display
          EXPORTING
             IS_STABLE    = <structure of type LVC_S_STBL.
    in parameter  IS_STABLE set fields row and col to 'X'. 
    If the problem persists, use [get_current_cell|http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b552fad30911d2b467006094192fe3/frameset.htm] in PAI/event handler and [set_current_cell_via_id|http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b55327d30911d2b467006094192fe3/frameset.htm] after [refresh_table_display|http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b5531ed30911d2b467006094192fe3/frameset.htm]
    Regards,
    Raymond

  • The code to set focus and cursor position fails in a mobile browser

    In two previous discussions (http://scn.sap.com/message/15176399 and http://scn.sap.com/message/15205348) I received help on how to set the focus on an OpenUI5 mobile input field and then how to position the cursor at the end of any text that might be in that field.
    That all works well in desktop browsers (Chrome, Firefox and IE10).
    However that same code seems to fail when I test it on browsers on mobile devices. At first I thought this was working in Chrome on an iPad but now it does not (could our taking new OpenUI5 code recently affected that?). I do not think I have ever see this work in Chrome on a, Android tablet.
    Has anyone had success setting the focus and cursor position on a mobile input field running in a mobile environment?

    Wasn't sure where to turn with this problem. There is talk on the web that there is a problem in Chrome on Android and that this will be fixed in version 37. We I get that version I will try and update this post.

Maybe you are looking for

  • My iPad will not show up in iTunes but my iPod does

    Hi there, my iPad will not show up under Devices on iTunes but my iPod is showing up ok.  Any help please??

  • External drive - READ ONLY

    What's with the hard drives customers buy from the apple stores? I have had this hard drive for a few weeks now and after reformatting the drive 5 times and coped a few items to the drive a few days latter it says read only you cant copy to this driv

  • Making Video for the Driod

    Has anyone been able to output a video for the Motorola Droid? How do you do this? Scott

  • Navigation on Measure labels

    Hi, I wanted to navigate on the measure labels(which display the column name) in pivot view to another report. How can I achieve this? I tried setting in column format , the column heading interaction to Navigate, but its not working. Cheers.. sp

  • Finding more space on HD

    My MBPro has Leopard and Windows XP via Boot Camp. The 160GB drive is partitioned in half between the two systems. I am running out of HD space on the Mac side. I noticed that there are two library folders, one in the root and one in my user account.