Thread: Get user input

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    65
    Rep Power
    2

    Get user input


    i am having two problems. 1st is i want to print 3 char from string. i dont want to print ontop of each other so i am doing 600*i. but this not really working.
    Code:
    g.drawString(username[i], 600*i, 300);
    2nd question is that if user hit 3 keys at same time than in string it will add only one and string will be full. bc user hit 3 times at same time.


    full code
    Code:
    int z = 0;
    String username[] = new String[3];
    
    public void keyPressed(KeyEvent e)
        {
            int keys = e.getKeyCode();
    
            username[z] = KeyEvent.getKeyText(keys);
            e.consume();                  
        }
    
    public void keyReleased(KeyEvent e)
    { 
        int keys = e.getKeyCode();
    
        z++;
        e.consume(); 
    }
  2. #2
  3. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    348
    this not really working.
    Please explain what the problem is.

IMN logo majestic logo threadwatch logo seochat tools logo