Keyboard input through swing

How do I make it so that in swing a person can press a keyboard button and it will then go to a new screen with out the unput dearea being visable. I tried doing it with a text area but when I made it invisible it would not respond to keyboard input?

hi buddy,
u can create a new JFrame and call tht in the text area's ActionListener
and then while creating the JFrame use the Following code to close the frame on exit,
ur swing program will surely respond to it then
JFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
in case u want to get the text b4 closing u can use a string variable to set the text to it and then come out,
cheers,
hayath

Similar Messages

  • Keyboard input in swing app

    If you have a swing app how do you listen to keyboard clicks? (Similar actionListener with buttons menus etc)
    For example up, down,right, left...

    From the Swing tutorial, here is the section on "Listeners Support by Swing":
    http://java.sun.com/docs/books/tutorial/uiswing/events/eventsandcomponents.html
    Check out the Key Listener.

  • I need to get Keyboard input as well as mouse input on a JButton

    I need to get Keyboard input as well as mouse input on a JButton
    I have attempted to implement KeyListener. I get the keyCode but I need it to go in to the same String variable as my Actionlistener section.

    Here is the code I have trouble with getting keyboard input as wells as mouse input into the same variable.
    public class Calctester extends JFrame
    implements ActionListener, KeyListener
    private double var1, var2;//var1 and var2 are used to perform calculation
    String operand1 = "";//takes first input until an operator is pressed
    String operand2 = "";//takes input after operator is invoked
    double result;//is used to store the result
    boolean flag = false;//to signal operator pressed
    boolean decimalFlag = false;//to signal decimal pressed
    String stringInput;//used as a temporary store for all entry to allow for conditions to be evaluated
    char ch; //used to store the operator for comparison//Reason is pre does not compare using string
    String pre = "";//used to store the operator
    double mem; //will hold memory operation values
    double vMod; //Temporary store for var2 to be used with percent operations
    //Creates buttons
    JButton btn0 = new JButton("0");
    JButton btn1 = new JButton("1");
    JButton btn2 = new JButton("2");
    JButton btn3 = new JButton("3");
    JButton btn4 = new JButton("4");
    JButton btn5 = new JButton("5");
    JButton btn6 = new JButton("6");
    JButton btn7 = new JButton("7");
    JButton btn8 = new JButton("8");
    JButton btn9 = new JButton("9");
    JButton btnC = new JButton("C");
    JButton btnCE = new JButton("CE");
    JButton btnBkpSpc = new JButton("Backspace");
    JButton btnPlus = new JButton("+");
    JButton btnMinus = new JButton("-");
    JButton btnMultiply = new JButton("*");
    JButton btnDivide = new JButton("/");
    JButton btnEquals = new JButton("=");
    JButton btnPeriod = new JButton(".");
    JButton btnPlusMinus = new JButton("+/-");
    JButton btnSqrt = new JButton("sqrt");
    JButton btnMod = new JButton("%");
    JButton btnOneOverX = new JButton("1/x");
    JButton btnMC = new JButton("MC");
    JButton btnMR = new JButton("MR");
    JButton btnMS = new JButton("MS");
    JButton btnMPlus = new JButton("M+");
    //Displays Text area for Display
    JTextField txtArea = new JTextField("0.");//The calculation display area set to 0.
    JTextField mArea = new JTextField();//to display memory operations
    //Default constructor
    Calctester()
    //Defines a content pane
    Container c = getContentPane();
    //Defines the layout of the frame and sets it to null to allow absolute positioning
    c.setLayout(null);
    //Defines event handling
    btn0.addActionListener(this);
    btn1.addActionListener(this);
    btn2.addActionListener(this);
    btn3.addActionListener(this);
    btn4.addActionListener(this);
    btn5.addActionListener(this);
    btn6.addActionListener(this);
    btn7.addActionListener(this);
    btn8.addActionListener(this);
    btn9.addActionListener(this);
    btnC.addActionListener(this);
    btnCE.addActionListener(this);
    btnBkpSpc.addActionListener(this);
    btnPlus.addActionListener(this);
    btnMinus.addActionListener(this);
    btnDivide.addActionListener(this);
    btnMultiply.addActionListener(this);
    btnEquals.addActionListener(this);
    btnPeriod.addActionListener(this);
    btnPlusMinus.addActionListener(this);
    btnSqrt.addActionListener(this);
    btnMod.addActionListener(this);
    btnOneOverX.addActionListener(this);
    btnMR.addActionListener(this);
    btnMS.addActionListener(this);
    btnMPlus.addActionListener(this);
    btnMC.addActionListener(this);
    btn1.addKeyListener(this);
    //Adds the buttons to the frame and sets the font of the label to be
    //logical font Dialog,plain as opposed to Bold and the label size to 12
    //Also sets the border type of aech button
    c.add(btn0).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn0.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn1).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn1.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn2).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn2.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn3).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn3.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn4).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn4.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn5).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn5.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn6).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn6.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn7).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn7.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn8).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn8.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn9).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn9.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnC).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnC.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnCE).setFont(new Font("Helvetica", Font.PLAIN, 12));
    btnCE.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnBkpSpc).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnBkpSpc.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnPlus).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnPlus.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnMinus).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnMinus.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnMultiply).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnMultiply.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnDivide).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnDivide.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnEquals).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnEquals.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnPeriod).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnPeriod.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnPlusMinus).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnPlusMinus.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnMod).setFont(new Font("Albertus Medium", Font.PLAIN, 12));
    btnMod.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnSqrt).setFont(new Font("Microsoft San Serif", Font.PLAIN, 11));
    btnSqrt.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnOneOverX).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnOneOverX.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnMC).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnMC.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnMS).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnMS.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnMR).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnMR.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnMPlus).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnMPlus.setBorder(new BevelBorder(BevelBorder.RAISED));
    //sets the color of the label of the buttons
    btnC.setForeground(Color.red);
    btnCE.setForeground(Color.red);
    btnBkpSpc.setForeground(Color.red);
    btnDivide.setForeground(Color.red);
    btnMultiply.setForeground(Color.red);
    btnMinus.setForeground(Color.red);
    btnPlus.setForeground(Color.red);
    btnMC.setForeground(Color.red);
    btnMR.setForeground(Color.red);
    btnMS.setForeground(Color.red);
    btnMPlus.setForeground(Color.red);
    btnEquals.setForeground(Color.red);
    btn0.setForeground(Color.blue);
    btn1.setForeground(Color.blue);
    btn2.setForeground(Color.blue);
    btn3.setForeground(Color.blue);
    btn4.setForeground(Color.blue);
    btn5.setForeground(Color.blue);
    btn6.setForeground(Color.blue);
    btn7.setForeground(Color.blue);
    btn8.setForeground(Color.blue);
    btn9.setForeground(Color.blue);
    btnPlusMinus.setForeground(Color.blue);
    btnSqrt.setForeground(Color.blue);
    btnMod.setForeground(Color.blue);
    btnOneOverX.setForeground(Color.blue);
    btn0.setFocusPainted(false);
    btnPlus.setFocusPainted(false);
    btnEquals.setFocusPainted(false);
    //The display text area and the memory operation text area
    c.add(txtArea);
    txtArea.setBorder(new BevelBorder(BevelBorder.LOWERED));
    txtArea.setBounds(7,0,240,25);//To provide a Text box @ the top of the frame
    txtArea.setEditable(false);
    txtArea.setBackground(Color.white);
    c.add(mArea);
    mArea.setBounds(13, 35, 28, 25);
    mArea.setEditable(false);
    mArea.setBorder(new BevelBorder(BevelBorder.LOWERED));
    setSize(260,251);//size of the frame
    setTitle("Calculator"); //Title
    setVisible(true); //this makes the frame visible on the screen
    setResizable(false); //this disallow resizing of the frame
    setDefaultCloseOperation(EXIT_ON_CLOSE);//to close app
    //instead of the above method you can use the WindowsListener which extennds other classes and implements other interfaces.
    setLocation(300,200);//positioning of the window on the screen
    txtArea.setHorizontalAlignment(JTextField.RIGHT);//sets the text in the text field to the right
    mArea.setHorizontalAlignment(JTextField.CENTER);//centers the label
    JMenu editMenu = new JMenu("Edit");//creates menu
    JMenuItem copy = new JMenuItem("Copy Ctrl+C");//creates menu item
    copy.addActionListener(this);//event handling
    JMenuItem paste = new JMenuItem("Paste Ctrl+V");//creates menu
    paste.addActionListener(this);//event handling
    JMenuBar myMenu = new JMenuBar();//declares a menu bar
    setJMenuBar(myMenu);//adds the menu bar to the frame
    editMenu.setBorderPainted(false);//removes the border shadow around the menu bar
    myMenu.setBorderPainted(false);//removes the border shadow around menu bar
    //adds menu items to the menu, sets the font and font size.
    editMenu.add(paste).setFont(new Font("Dialog", Font.PLAIN, 12));//
    editMenu.add(copy).setFont(new Font("Dialog", Font.PLAIN, 12));
    myMenu.add(editMenu).setFont(new Font("Dialog", Font.PLAIN, 12));
    JMenu viewMenu = new JMenu("View");//creates menu
    JMenuItem sci = new JMenuItem("Scientific");//creates menu item
    sci.addActionListener(this);//event handling
    JMenuItem std = new JMenuItem("Standard");//creates menu item
    //adds menu items to the menu, sets the font and font size.
    viewMenu.add(sci).setFont(new Font("Dialog", Font.PLAIN, 12));
    viewMenu.add(std).setFont(new Font("Dialog", Font.PLAIN, 12));
    myMenu.add(viewMenu).setFont(new Font("Dialog", Font.PLAIN, 12));
    JMenu helpMenu = new JMenu("Help");//creates menu
    JMenuItem helpTopics = new JMenuItem("Help Topics");//creates menu item
    JMenuItem aboutCalc = new JMenuItem("About Calculator");//creates menu item
    helpTopics.addActionListener(this);//event handling
    //helpTopics.setBorder(new BevelBorder(BevelBorder.RAISED));
    helpTopics.setBorder(LineBorder.createGrayLineBorder());
    //adds menu items to the menu, sets the font and font size.
    helpMenu.add(helpTopics).setFont(new Font("Dialog", Font.PLAIN, 12));
    helpMenu.add(aboutCalc).setFont(new Font("Dialog", Font.PLAIN, 12));
    myMenu.add(helpMenu).setFont(new Font("Dialog", Font.PLAIN, 12));
    //aboutCalc.setBorder(new BevelBorder(BevelBorder.RAISED));
    aboutCalc.setBorder(LineBorder.createGrayLineBorder());
    //aboutCalc.setActionCommand("Nothing here right now");
    //Setting absolute positions for the buttons.
    btn0.setBounds(50, 160, 35, 28);
    btn1.setBounds(50, 130, 35, 28);
    btn2.setBounds(90, 130, 35, 28);
    btn3.setBounds(130, 130, 35, 28);
    btn4.setBounds(50, 100, 35, 28);
    btn5.setBounds(90, 100, 35, 28);
    btn6.setBounds(130, 100, 35, 28);
    btn7.setBounds(50, 70, 35, 28);
    btn8.setBounds(90, 70, 35, 28);
    btn9.setBounds(130, 70, 35, 28);
    btnC.setBounds(180, 35, 63, 28);
    btnCE.setBounds(115, 35, 63, 28);
    btnBkpSpc.setBounds(50, 35, 63, 28);
    btnPlus.setBounds(170, 160, 35, 28);
    btnMinus.setBounds(170, 130, 35, 28);
    btnMultiply.setBounds(170, 100, 35, 28);
    btnDivide.setBounds(170, 70, 35, 28);
    btnEquals.setBounds(210, 160, 35, 28);
    btnPeriod.setBounds(130, 160, 35, 28);
    btnPlusMinus.setBounds(90, 160, 35, 28);
    btnMC.setBounds(8, 70, 35, 28);
    btnMR.setBounds(8, 100, 35, 28);
    btnMS.setBounds(8, 130, 35, 28);
    btnMPlus.setBounds(8, 160, 35, 28);
    btnSqrt.setBounds(210, 70, 35, 28);
    btnMod.setBounds(210, 100, 35, 28);
    btnOneOverX.setBounds(210, 130, 35, 28);
    // btn7.addKeyListener(this);
    try
    UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    SwingUtilities.updateComponentTreeUI(this);
    catch (Exception e)
    System.out.println("Could not load Metal Look and Feel");
    public void keyReleased(KeyEvent e)
    //btn1 = txtArea.getRegisteredKeyStrokes();
    // System.out.println(1);
    // keyTyped();
    public void keyPressed(KeyEvent e)
    //if (e.getActionCommand().equals("1"));
    //(e.getKeyText().compareTo("1"));
    //(e.getKeyCode().equals("1"));
    //else
    System.out.println("Error");
    //keyTyped();
    public void keyTyped(KeyEvent e)
    //displayInfo(e, "KEY TYPED: ");
    System.err.println("KeyTyped >>> " + e.KEY_TYPED);
    //keyEvent.keyTyped();
    // e.KEY_TYPED;
    /* protected void displayInfo (KeyEvent e, string s)
    {KeyCodeString;
    int keyCode = e.getKeyCode();
    keyCodeString = "key code " + keyCode
    + "("
    + KeyEvent.getKeyText(keyCode);
    public void actionPerformed(ActionEvent e)
    stringInput = e.getActionCommand();
    System.out.println("First stringInput action performed>>" +stringInput);
    System.out.println("First pre action performed>>" +pre);
    if (stringInput == "C")
    operand1 = "";
    operand2 = "";
    var1 = 0;
    var2 = 0;
    var1 = result;
    txtArea.setText("0.");
    flag = false;//to force the operations to jump to operand 1 and go through the loop as normal
    pre = "";
    if (stringInput == "CE")
    operand2 = "";
    var2 = 0;
    txtArea.setText("0.");
    flag = true;//to force the operations to jump to operand 1 and go through the loop as normal
    if (stringInput == "MR")
    if (var1 != 0)
    txtArea.setText(Double.toString(var1));
    mArea.setText("M");
    System.err.println("mem@operand1 >> "+ mem );
    else if (var2 != 0)
    txtArea.setText(Double.toString(var2));
    mArea.setText("M");
    System.err.println("mem @ mR else>> "+ mem );
    if (stringInput == "MS")
    mArea.setText("M");
    if (operand1 != "")
    mem = var1;
    else if (operand2 != "")
    mem = var2;
    else
    mem = 0;
    if (stringInput == "MC")
    mArea.setText("");//to clear the text area display
    mem = 0;//to reset the variable
    if (stringInput == "M+")
    mArea.setText("M");
    flag = true;//to force the operations to jump to operand 2 and go through the loop as normal
    if (stringInput == "=")
    //result = evaluate();
    txtArea.setText(Double.toString(result));
    System.out.println("Equals>>" +stringInput);
    System.out.println("Equals>>" +pre);
    System.err.println("The flag at equals is " + flag);
    if (stringInput == "+"||stringInput == "-"||stringInput == "/"||
    stringInput == "*"||stringInput == "=")
    pre = pre.concat(stringInput);
    System.out.println("Second action perfo/check for operator>>" +stringInput);
    System.out.println("Second pre action perfo/check for operator>>" +pre);
    operand2 = "";
    System.err.println("The flag at +,- etc is " + flag);
    if(!flag &&(stringInput == "*"|| stringInput == "/"))
    var2 = 1;
    stringInput = "";
    flag = true;
    if(!flag)
    stringInput = pre;
    System.out.println("if flag true/stringInput" +stringInput);
    System.out.println("flag true/pre" +pre);
    else
    //These statements extract the operator
    stringInput = pre.valueOf(pre.charAt(pre.length()-2));
    ch = pre.charAt(pre.length()-2);
    System.out.println("@ position -2 stringInput" + pre.valueOf(pre.charAt(pre.length()-2)));
    System.out.println("@ position -2 pre" + pre.charAt(pre.length()-2));
    result = evaluate();
    var2 = 0;
    operand2 = "";
    txtArea.setText(Double.toString(result));
    System.out.println("Total is " + result);
    flag = true;
    if(!flag &&(stringInput == "*"|| stringInput == "/"))
    var2 = 1;
    stringInput = "";
    flag = true;
    if (stringInput == "%")
    //evaluate();
    txtArea.setText(Double.toString(result));
    System.err.println("mem @ mR else>> "+ result + " %" );
    if (stringInput == "1/x")
    if (operand1 != "")
    txtArea.setText(Double.toString(1/var1));
    //System.err.println("mem@operand1 >> "+ mem );
    else if (operand2 != "")
    operand2 = "";
    txtArea.setText(Double.toString(1/var2));
    //System.err.println(">> "+ mem );
    if (Character.isDigit(stringInput.charAt(0))||stringInput == ".")
    System.out.println(operand1);
    if (stringInput == "." && operand1 == "")
    operand1 = "0";
    System.out.print("fail op1");
    if (stringInput == "." && operand2 == "")
    System.out.print("fail op2");
    operand2 = "0";
    if (flag==false)
    operand1 = operand1.concat(stringInput);
    result = Double.parseDouble(operand1);
    System.out.println("op1 =>" + operand1);
    txtArea.setText(operand1);
    //result = var1;
    System.out.println("result after var1 = result " + result);
    else
    operand2 = operand2.concat(stringInput);
    var2 = Double.parseDouble(operand2);
    //var2 = vMod;
    System.out.println("op2 =>" + operand2);
    txtArea.setText(" ");//to clear the text area
    txtArea.setText(operand2);//to display the second number if (operators == "+")
    System.out.println("result after var2 " + result);
    public double evaluate()
    if (ch == '+' )
    result = result + var2;
    if (ch == '-' )
    result = result - var2;
    if (ch == '/' )
    result = result / var2;
    if (ch == '*' )
    result = result * var2;
    if (ch == '%')
    var2 = Double.parseDouble(operand2);
    result = result/vMod*100;
    System.out.println("% "+ result);
    return result;
    public static void main(String [] args)
    Calctester x = new Calctester();
    }

  • How to use the phone's Mini-Keyboard Input with the 'Textbox'(MIDP2.0)?

    (My apology. My English is not perfect but I'll try my best. >_<)
    Hi. I'm trying to create a textbox(in my own little application) that is compatible with the mini-keyboard input feature.
    This problem involved any device that have a built-in "mini-keyboard".
    Problem:
    I tried the 'Textbox' class from MIDP2.0 but the result, as expected, is like using the phones with no built-in keyboard.
    (Forexample if I want to input the character 'C' inthe text box, I need to press number '2' button three times to let it circle through 'A' -> 'B' then 'C'. )
    Then I tried entering URLs in the phone's built-in web browser, the result is I can use the mini keyboard to type like a PC keyboard.
    Question: How do I implement such textbox that is fully compatible with the built-in mini Keyboard?
    I tried browsing through the MIDP2.0 API but it seems the 'Textbox' class there couldn't do it.
    Thank you. =)
    /bow
    Edit/Delete Message

    The textbox should have input just as any other normal phone input. If not, something strange is going on.
    Anyway , there is no use to make your own input method, since every phone has another implementation of this anyway. It would only confuse users.

  • Spaces locks keyboard input

    Per Sean Dale1, the following was mis-posted in the 10.5 Leopard thread (original post here: http://discussions.apple.com/thread.jspa?threadID=2201088):
    Have been running into this problem more and more frequently on both a MacBook Pro and Mac Pro tower running 10.6.1 and 10.6.2: when I Control-right-arrow to move to my other "space" one or two of two bad things will happen:
    (1) the icon in the middle-bottom of the screen showing which "space" I'm in does NOT fade away and disappear
    (2) I am prevented from doing ANY keyboard-input into my programs there. I will be able to click and highlight windows using the mouse, as well as see menus activating and such, but anywhere there is a text field (browser or address book or ANYwhere) keyboard input is not displayed.
    The only solution is to go into the Activity Monitor and quit the Dock application.
    Have been seeing this problem for a few weeks which persists through reboots and such.
    Ideas?

    This issue is being covered in more detail at this thread:
    http://discussions.apple.com/thread.jspa?threadID=2161076
    This suddenly started happening to me yesterday and now happens every time I switch Spaces with the keyboard. I've found that the only way around it is to only use the menubar icon to switch. Because I'm so used to clicking keys to switch Spaces and still do it unconsciously, I've disabled the keys in Spaces prefs.

  • Reader Closes on any Keyboard input

    Has anyone had this problem?
    Reader closes on any keyboard input.
    Mouse works fine.  And I mean any keyboard action at anytime.
    I have tried uninstalling all adobe reader apps/plugins and reinstalling the latest available version but still Reader closes with any keyboard input.   Make opening password protected PDF's impossible.  The "find" function unusable.
    Any Ideas?

    Are you trying to run your application through TextPad, or some IDE? The System.in is best for command prompt input. Trying running your program through the command prompt, and it should work fine.
    I replicated your error, running your application through TextPad.

  • Keyboard input or Console Output

    I'm self teaching java... I got stuck with one of the exercises that is supposed to demonstrate the basic input and output through entering data on console...
    I went about writing the code as:
    public class Program2 {
    public static void main(final String [ ] args) {
    KeyboardInput in = new KeyboardInput () ;
    System.out.print ("Type your name: ") ;
    It doesn't compile:((((.... it says "KeyboardInput" is not a type...
    I would really appreciate if somebody could respond to this silly problem.

    For keyboard input from console the program would be
    public class Console{
      public static void main(String[] args){
        try{
          BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
          System.out.print("Enter Your Name: ");
          String name = reader.readLine();
          System.out.println("Your Name is "+name);
        }catch(Exception ex){
          ex.printStackTrace();
    }

  • Disable Keyboard Input

    Hi folks,
    May I know how to disable/ignore keyboard input in a Swing application ? Of course, just for a short period and need to resume afterward. Thanks a lot.
    KC

    Fairly straight forward. Implement the KeyListener interface. Make your keyPresses, keyReleased and keyTyped methods consume the event. If you want to make this dependent on some condition, then set a boolean indicator and check it each time the KeyListener methods are called.

  • Keyboard input allowed with iPhone/iTouch remote software?

    I have searched through the posts but haven't seen a definite answer: Can anyone confirm if keyboard input via the iPhone/iTouch remote software is available with the ATV 2.1 update? I don't have an iPod Touch (yet) so I can't test this out.
    Utilizing an iPod Touch/iPhone virtual keyboard would be SO much better than the little white remote when doing searches in Youtube/iTunes music etc.

    Works like a champ using 2.0 and Remote on my Gen 1 iPhone.
    You can type in search terms and it behaves just like iTunes, narrowing the results as you type.
    Plus you can scroll long lists of songs or other content very rapidly and use the alphabet column (like Contacts on the phone) to jump quickly.
    -dan

  • Keyboard input from console

    I have a swing GUI application which must show content reflecting to keyboard input.
    Input must be readed from System.in. When I type anything in console it works, but when
    I switch to GUI then keyboard input doesnt go to System.in. Any ideas how to solve this problem?
    Make keyboard input go to System.in while looking the GUI?
    Thank you in advance.

    I registred JFrame as keydispatcher and everything worked fine, except the fact that every keystroke got catched in dispatchEvent() three times.
    What concept am I missing? How to get one occurance of each keyevent?

  • Keyboard input for a nubie!!!!

    Can anyone help me with writng a method that accepts all keyboard input and writes it to a file? I.e. whenever a key is pressed (only letters and numbers), it is accepted even if no programs are running and no text editor is being used.
    This will help me great deal and I would be very appreciative for any help I might receive.
    Thanking any response
    ChaosSupreme

    Is this like making a key logger? It takes down all your input and saves it to a file? If it is I'm sure there are plenty of tutorials on how to make a key logger out there.
    I guess you would have to look up buffered writer and rile writer methods, although I think they are just through a text editor or program.
    Andy

  • Keyboard Input issue

    I recently started having an issue with the keyboard input.  If I power down then power up the keyboard input will work for a little bit.  Basically, whatever I try to type doesn't show up in the message area. This really goes for any application, web browsing, text messaging, emailing, etc.  In conjunction with this problem I am having an issue with making a basic phone call as well. if I dial a number or select a contact to call, the call is not immediately made and I may wait for a minute before the call starts going through.  What should I do?

    Thank you ! I set the "Bounce Key" off, and it works
    stefanwilkens wrote:
    Hi,
    Please check in gnome 3's control center under "Universal Access" in the "Typing" tab, it sound like either Slow Keys or Bounce Keys is enabled.
    if you can't find gnome 3's system settings, you can start it by running:
    /usr/bin/gnome-control-center

  • [SOLVED] wmii ignores all keyboard input

    I'm trying to use wmii on my new arch install. No matter which of the wmiircs I use, it never accepts any keyboard input to switch tags, open windows or anything else. The clock is correctly updated and if I open a window using DISPLAY=:1 from another terminal, I can move it around with the mouse. Evilwm is working fine and the only error in Xorg.0.log is related to fbdev. Does anyone have any idea what might be going wrong here?
    EDIT: Just a major PEBKAC. I forgot that Win is the new default modkey and wmii didn't ask me because xmessage wasn't installed.
    Last edited by A.W.A.M (2011-03-12 09:25:52)

    Anyone have any ideas? I tried reinstalling base and base-devel through pacman...still no relief.... This is bizarre.
    EDIT: It's getting worse. System now hangs on boot at "Waiting for UDev uevents to be processed." Things are rapidly going downhill.
    EDIT: No booting due to Udev fixed my booting without acpi. I rebooted into another linux distro to poke around in /var/log/pacman.log for a bit to see if I could find the offending update. Nothing seemed really suspicious, except for the update to "linux-api-headers." (Anything with "headers" is suspicious. So, I decided I would boot back into Arch and try to downgrade that package. After booting back into Arch, I see that the problem has disappeared...so...I dunno what to say...I have no idea what/how this got fixed, or how I (yes, let's be honest here...it must be "I") broke it in the first place.
    Last edited by lasu1 (2010-03-28 00:44:43)

  • TS3280 How can i enable both paired bluetooth and ios keyboard input at the same time?

    How can i enable both paired bluetooth and ios keyboard input at the same time?
    This is needed for the app im working on. Need some user input via keypad as well as scanner input via a paired bluetooth scanner.

    You probably should not be using a keyboard bluetooth profile for a scanner, I am not a developer for apple so do not know the location for you to find out the correct profile you should be using for an input device that is not a keyboard. Sorry,
    I am sure if you navigate the apple developer site you will probaly finmd what you're looking for.
    https://developer.apple.com

  • I have a new mac book pro (sept 2014) and am suddenly stuck on the log-in screen. Keyboard input not working to enter my password. Already tried a basic restart and a cmmnd/ cntrl/ pwr troubleshoot to no effect.

    I have a new mac book pro (sept 2014) and am suddenly stuck on the log-in screen. Keyboard input is not working to enter my password. Seems to be a log in issue as keyboard works for forced troubleshooting. (And b/c when I first noticed the problem, I was able to enter my log in password but then everything sort of froze. Now, no ability to enter the password.) Already tried a basic restart and a cmmnd/ cntrl/ pwr troubleshoot to no effect.

    Reset PRAM:   http://support.apple.com/kb/PH14222
    Start up in Safe Mode.
    http://support.apple.com/kb/ph14204
    A new Mac is in warranty for 1 year from the date of purchase.
    A new Mac comes with 90 days of free tech support from AppleCare.
    AppleCare: 1-800-275-2273
    Call AppleCare or take it to the Apple store to have it checked out.
    Genius Bar reservation
    http://www.apple.com/retail/geniusbar/
    Best.

Maybe you are looking for

  • VAT registration No. in Company Code Global Parameters

    Hi All, I have tried to enter the Vat registration No. for a New Zealand Company Code and i have faced the error as "Entry of a VAT reg.no.is only possible for co.codes in EC countries" Pls let me know config step to enter the VAT reg no irrespective

  • Acrobat X does not install the Adobe PDF printer

    When I try to install the Acrobat X on a Vista SP2 machine, the installation completed successfully but it does not create the Adobe PDF icon in the printers section. This was not a problem earlier, but there were some microsoft patches and GPO updat

  • Viewing clip in full screen mode

    I have not figured out how to view a clip that I have imported into FCE in the full screen format like you can do in imovie. Anyone have any suggestions? Thanks TimHA

  • Work iPad, iCloud account already on it. How do I delete?

    I have a work iPad and am trying to set up my iCloud account on it. The problem is, there is an iCloud account set up by the previous user. I obviously don't have his password so I can't delete the account. What do I do?

  • Getting an Error message when i Upgrade?

    I am trying to upgrade to iTunes 7, the download is fine but during the final part of the upgrade I get this error which says "Could Not access Netowrk location %USERPROFILE%\mydocuments\mypictures" very weird, if you know what it is let me know that