KeyListener for a command line application

Hi, I'm currently writing a small command line application aimed at interacting with a database. I would like to implement features such as an automatic completion of the names with the TAB key. My problem is that the objects that sends KeyEvent are AWT components, and they do that when they have the focus. So I was wondering if any of you had already done such a thing. Until now, I tried lots of things, but there is no way I can catch a KeyEvent within the command line...
Souk

Write your own input routine that internally reads a character at a time instead of a complete line or string and test the character for tab etc. and take the appropriate action. This also means you will have to/can implement editing keys.
If there is a Java class that has an dictionary to compare input with I do not know, because the last time I wrote a tool without gui was in 1985.
Regards
SH

Similar Messages

  • Telnet Server or Command Line Applications

    Hi,
    Bit of a random question to ask seeing as no one has asked it before...but...
    Is there a TELNET SERVER or command line application around for the N series phones? I'm keen on doing some console work with my N82 to explore the symbian interface more.
    Any ideas?
    Owned: Nokia 3510i, Nokia 3120, Nokia 6230i, Nokia 6233, Nokia N73, Nokia N82.
    Current: Nokia N900!

    24-Mar-2008 02:25 PM
    psychomania wrote:
    This has been posted a few times recently for other models and I think someone posted a link to a useful app that works.
    Are you sure of this, Psycho?
    I've seen links to telnet and ssh CLIENTS for S60 here, not for servers.
    Message Edited by grschinon on 24-Mar-2008 02:38 PM
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • Can the command line application be extended?

    I would like to add command like keys etc..Is this possible?

    Correct me if I am wrong, from what I understand, beanShell is a scripting language which interprets the Java language. Yes, I could connect to coherence cache and run any commands I want. However, that won't include the commands which are already prefined in the tangosol command line, would it?
    If I am wrong, I would appreciate if you could show me an example of beanShell and the command line application.

  • [Request] Betty: Friendly English-like interface for your command line

    Anyone with the capacities and interest to maintain Betty?
    Betty is a friendly English-like interface for your command line.
    She translates English-like phrases into commands in case you every run into situations like this.
    This means you don't have to leave your command line to look up an obscure but useful command. Just ask Betty!
    Discussion on reddit: http://www.reddit.com/r/linux/comments/ … x_command/
    Source on Github: https://github.com/pickhardt/betty

    I liked a lot of the ideas you posted.  Though I have to disagree with the idea of having tablets being into the size range of over 12".  You start getting larger than that and you may as well start using a laptop. On the flip side of that, I have to agree that there are too many of the 7" available,  which are almost too small.  The 8-10" tablets give you the portability and smaller size people want for stuffing into their bags,  purses, etc. The larger tablets are getting into that bulky area and that defeats the purpose of the tablet to begin with. Unfortunately I find myself using e-books more than I intended,  but I don't need a full, or larger than a full, sized sheet of paper.   They get harder to handle,  even with Lenovo 's great form design.  
    The only reason to have more than one tablet is if the developers can't come to terms and allow their products to be used across the board (talking of Amazon and Google here). I personally don't want to be carrying around more than one tablet and a phone. I want to simplify and streamline not add more bulk. 
    I loved that you pointed out that our voices will never replace our fingers. I don't like speaking to inanimate objects; too many experiences with automated phone services that did not end up well. 
    I congratulate Lenovo for their innovative design with the Yoga tablets. 

  • Command line applications

    Hi,
    does anybody know how to create a class that represents a command line application that would use a previously created class's methods and variables?
    Jamie

    Is this what you're after?
    You can compile these 2 together as is with InUser.java - though better to compile the class In.java seperately then you will be able to use it elsewhereimport java.io.*;
    // Note: this class has NO "main()" so it cannot work alone
    class In{
       private static InputStreamReader isr = new InputStreamReader(System.in);
       private static BufferedReader in = new BufferedReader(isr);
       public static void prompt(String s) {
          System.out.print(s);
          System.out.flush();
       public static String getString(){
          String str = null;
          try {
             str = in.readLine();
          catch (IOException e){
             System.out.println("Error: In.Read() "+e.getMessage());
             System.exit(0);
       return str;
       public static int getInt(){
          int ii = 0;
             try {
             ii = Integer.parseInt(in.readLine() );
          catch (NumberFormatException nfe){
             System.out.println("Error: the number is not convertable to an int");
          catch (IOException e){
             System.out.println("Error: In.Read() "+e.getMessage());
             System.exit(0);
       return ii;
       public static double getDouble(){
          double dd = 0D;
             try {
                dd = Double.parseDouble(in.readLine() );
             catch (NumberFormatException nfe){
                System.out.println("Error: the number is not convertable to a double");
             catch (IOException e){
                System.out.println("Error: In.Read() "+e.getMessage());
                System.exit(0);
       return dd;
    // And the user with file with a main signature:
    public class InUser{
       public static void main(String[]args){
          System.out.println("\nExample 'In.java' with Readln:");
          In.prompt("Please enter your name: ");
          String name = In.getString();
          System.out.println("Welcome "+name); 
          In.prompt("Please enter a whole number: ");  
          int ii = In.getInt();
          System.out.println("The number squared is "+(ii*ii)); 
          In.prompt("Please enter a fraction number: ");  
          double dd = In.getDouble();
          System.out.println("The numbers square root is " +Math.sqrt(dd));    
    }

  • Develop a command-line application using LabVIEW

    Hi,
             Is it possible to generate a command line(CLI) executable using LabVIEW? This CLI exe will be called with certain command line arguments by another application (written in Visual Basic). The LabVIEW Run time engine can be installed separately on the host PC.
    Thanks for your help
    Siddharth 
    Solved!
    Go to Solution.

    There is an example that ships with LabVIEW that shows how to read the command line arguements from an application. THe name of the VI is CommandLine.vi. It is extremely basic though. The power of command line arguements really comes from how you define and parse them. I recommend allowing your command line arguements to be order independent and that they require a label. For comand lines I prefer to use a single letter for the label. Full words are nice but then your command line gets very long. For the applications that we write we allow both the '/' (DOS/Windows style) and the '-' (Unix/Linux style) to designate a command line label.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • [SOLVED] Vocabulary Trainer or Learning Archit. for the Command Line

    I am writing my PhD in English which actually is not my native language. So vocabulary and expression learning is an important task. When I came to Arch part of the decision was also ralted to my whish to work as close to the Command Line as possible. So I am looking everywhere to find a vocabulary trainer for the shell. Unfortunately I was not able to find even one. I looked:
    - at the Arch Wiki 'List of Applications'
    - at the Ubuntu Wiki 'Shell Applications'
    - at http://www.jaredandcoralee.com/CLIapps.html
    - searched both the Arch and Ubuntu Wiki
    - searched Google for 'Vocabulary Trainer cli', 'Vocabulary Tainer terminal emulator', 'Vocabulary Trainer Linux Shell'
    Is anyone aware of such an application for the shell or has anyone ideas for a kind of work around using a combination of existing software/shell scripts/shell commands.
    Thanky you.
    PS: Of cause I could just start something like simple Python Script working with a csv file or something comparabla. But if possible I would like to avoud this DIY solution.
    Last edited by cutuchiqueno (2013-08-30 10:12:06)

    Trilby wrote:
    I don't know of any training tools of that variety.  Generally this is a "learn by doing" situation - which fits with language learning as well: flash cards can seem handy, but to really learn a language, you just need to start using it.
    To "just start using" the shell, I'd suggest greg's wiki
    Ok, I think there is a misunderstanding. My question does not relate to learn to use the shell. Although far from being perfect I already feel quite comfortable with the shell and its ways to interact with the system.
    It's really more basic. I have to improve my English. And in this context I need a vocabulary trainer, to learn english words and english academic expressions, nothing more. And as I am feeling quite close to the shel it would have been nice to train english vocabulary on the shell and not with something like KWordQuiz, etc.
    Sorry if my description was ambiguous. So the question still is, is there a vocabulary trainer for self defined english vocabulary to train in the shell?
    PS: Of cause also learning english is something you mostly do by learning. But I will do  that anyhow as I am writing the PhD in english and as I am presenting in English. Anyhow I experienced that there is a part in foreign language learning where there is no real subsitutde for learning it with a vocabulary trainer.

  • Looking for pfi command line arguments.

    Hey,
    I've read through all documentation but can't find a list of all available command line arguments for pfi. the pfi -help does not list any options for me. Does anyone have a link to a list or is there some way to get the -help argument to output the list?
    Thanks,
    Jonas

    Below mentioned pdf has some info on the command line args of pfi under the heading Creating an iPhone application installer file from the command line
    http://download.macromedia.com/pub/labs/packagerforiphone/packagerforiphone_devguide.pdf
    Tanu

  • File format for username/password file for -vcusersfile command line option

    In what format do I specify username and password in a file that I can use for
    the -vcusersfile command line option?

    The text file should contain name/password pairs separated by an equal sign. Example:
    myname1=password1
    myname2=password2
    Hope that helps,
    Susan Doan

  • Variable does not work for sqlplus (command line)

    Here is an select:
    variable x number;
    variable y number;
    variable a number;
    define x = 2000;
    define y = 2*1000;
    define a = &x+&y;
    select ener from adding where ener = &a;
    When I execute it under SQL*Plus Worksheet (client installed on my PC) then I get output:
    ENER
    4000
    1 row selected
    When I execute this same under command line sqlplus (under unix shell) then I get output
    old 1: select ener from adding where ener = &a
    new 1: select ener from adding where ener = 2000+2*1000
    no rows selected
    What is worng ?

    Nothing.
    Sqlplus is correct and sql worksheet is buggy.
    Define works with strings only. You cannot use it to calculate an expression.
    Apparently sql worksheet did calculate the expression, and sqlplus didn't, submitting it as a string.
    This is the expected behavior.
    This behavior can likely vary by version, so thank you for not providing version info.
    Will anything awful happen when you do, or is this just the lazyness epidemia in this forum?
    Sybrand Bakker
    Senior Oracle DBA
    Experts: those who did read documentation.

  • Syntax for javac command line in DOS

    Can anyone help me with the proper syntax fror the javac command line? Based on the Java Tutorial, I type the following line while in: C:\Program Files\Java>
    c:\progra~1\java\bin\javac hellow~1.jav
    This returns the following error message:
    javac: invalid flag: hellow~1.jav
    Usage: javac <options> <source files>
    where possible options include:
    -g Generate all debugging info
    -g:none Generate no debugging info
    -g:{lines,vars,source} Generate only some debugging info
    Rest deleted, you get the drift. A long time has passed since I have used DOS, but I thought that options were just that; they were not essential to run a program. If they are necessary, how do you set an option? for example, I have tried the command:
    C:\Program Files\Java>c:\progra~1\java\bin\javac -g hellow~1
    which gives me the following error:
    javac: invalid flag: hellow~1
    I would really appreciate any suggestions anyone out there has for solving this apparently simple & stupid problem.

    Many thanks for these suggestions. I finally got javac to work by putting the file name HelloWorldApp.java inside of quote marks (i.e. "HelloWorldApp.java"). The program compiled the file, & I now have a HelloWorldApp.class file in my java directory. Unfortunately, I am now having trouble with the next tutorial step: getting java to use the file.
    I am discovering there are some very strange things about DOS since the last time I used it. For example, the cd command recognizes either cd c:\progra~1\java OR c:\"Program Files"\java. If the quote marks are omitted a "file not found" error is returned. There seems to be some sort of problem with ways that long file names are dealt with in DOS. I notice that many contribs to this list enter long file names or directories without quote marks; indeed, this is standard format in the java tutorial. This is probably a really dumb question, but is there someway to tell DOS to recognize long names without quote marks?
    Once again, thanks for the help.

  • How to Install IHAT10.1.3 for both command line and web

    Hi,
    I am trying to install iHAT10.1.3 onto my linux x86 machine. However the instruction I am following in the README is not working for me. Can anyone give me an example of how to install and view iHat for command line and the web
    Cheers
    Jat

    What stage during the instructions are you encountering problems. Can you provide the error details if any?
    The 10.1.3 iHAT is only Web based using Flash at the client for displaying compopnents. Unlike the old iHAT, there is not thick client provided to invoke from the command line.
    null

  • Logs for BIAR command line tool XI3.0

    Hi,
            Will there be any log files generated by the BIAR command line tool, when we try to export to a BIAR file?
    Thanks,
    Ashok Kumar M

    Information regarding the import can be found in the following locations:
    - Program Files\Business Objects\BusinessObjects 11.5\Logging
    - Program Files\Business Objects\BusinessObjects 11.5\win32_x86
    - Windows Event Viewer " If an error was encountered during import, the information will often be found here.
    To generate more logs during the import:
    Create a shortcut of the Import Wizard executable. The executable is found in <installation directory>:\Program Files\Business Objects\BusinessObjects Enterprise 11.5\win32_x86.
    Right-click the new shortcut. Click Properties.
    Click the Shortcut tab. Add "trace at the end of the Target command line as follows:
    "C:\Program Files\Business Objects\BusinessObjects Enterprise 11.5\win32-x86\ImportWiz.exe" -trace
    Click OK.
    When starting the import process, use this new shortcut instead of the previous one to start a trace. The resulting logs will reside in <installation directory>: \Program Files\Business Objects\BusinessObjects 11.5\Logging.
    Caroline

  • Lookup for WINS command line tool

    Hi ,
    Can anyone help me in finding a way to get a lookup tool or script to check WINS records.
    I have used nblookup but this only gives HostName to IP.
    I want it from IP to HostName from WINS.
    I have tried using nbtstat -A x.x.x.x also , but this is not fetching records from WINS. (not accurate)
    Sai Krishna

    Hi,
    According to your description, my understanding is that you need a command line tool to look up records from WINS.
    The command line nbtstat –A <IP address> , will returns the NetBIOS name table and MAC address corresponding to the IP address you typed, but the WINS does not queried during this process, the two
    nodes use NbtNs to request and respond the NetBIOS name between them.
    You may use netsh wins command to query names from WINS which you specified:
    >Netsh
    >WINS
    >Server <WINS IP address>
    >show name name=<record name> endchar=<16thCharInHex>
    This will find IP address and NetBIOS names according to the name. If you need to search name according to IP address, I suggest you use the
    display records in the WINS snap-in.
    Detailed information about netsh wins command line, reference the link below:
    http://msdn.microsoft.com/en-us/library/cc779375(v=ws.10).aspx#BKMK_53
    Regards,
    Eve Wang                                                                                                                                                  

  • Command Line Application Usage

    Can I use the command line app (coherence.cmd) to query values in an out of process cache? If so how would I go about that?

    Hi Karim,
    Let's assume you have a distributed cache named "Test1" on the cache servers. You can start the command line app on a cache client (localstorage=false) and join the same named cache that is running on the cache servers by typing the following command at the prompt:
    cache Test1
    From the prompt you can type the following command to display cache entries in this particular cache:
    list
    A list of available commands can be found by typing "help" at the prompt or here on the website here.
    I hope this helps.
    Best regards,
    Gary
    Tangosol, Inc.

Maybe you are looking for