Capturing the state of keyboard modifiers on startup

Discussion in 'Java' started by Aleksey Gureev, Mar 7, 2007.

  1. Hi Nutcrackers!

    Here's one interesting problem for you. I need to check the state of
    the modifiers during the startup sequence of the application to see if
    some special action should be taken. Imagine holding CTRL for the
    complete database reset and ALT to call the configuration wizard. The
    check is supposed to be performed right after the splash screen comes
    up (Swing is initialized).

    The question is if there is a place (hidden?) where the present
    keyboard modifiers state is held and could be queried? One way I
    imagine is to add a key listener code to the splash screen, but it's a
    kludge in my view.

    Any bright ideas?

    Thanks,

    -- Aleksey
     
    Aleksey Gureev, Mar 7, 2007
    #1
    1. Advertising

  2. Aleksey Gureev

    Jason Cavett Guest

    On Mar 7, 12:34 pm, "Aleksey Gureev" <> wrote:
    > Hi Nutcrackers!
    >
    > Here's one interesting problem for you. I need to check the state of
    > the modifiers during the startup sequence of the application to see if
    > some special action should be taken. Imagine holding CTRL for the
    > complete database reset and ALT to call the configuration wizard. The
    > check is supposed to be performed right after the splash screen comes
    > up (Swing is initialized).
    >
    > The question is if there is a place (hidden?) where the present
    > keyboard modifiers state is held and could be queried? One way I
    > imagine is to add a key listener code to the splash screen, but it's a
    > kludge in my view.
    >
    > Any bright ideas?
    >
    > Thanks,
    >
    > -- Aleksey


    So a specific "program" runs depends on keys that are being pressed
    upon startup? That's kind of confusing IMO.

    Since you want a configuration wizard (something in options, perhaps)
    and a reset (a button on the screen) - it just sounds like you want
    things that could be a part of the larger application.

    I could be wrong, of course, becuase I don't know exactly what your
    application is doing, but I'd suggest rethinking how the user will
    access different components of your interface. (At the very least, I
    wouldn't recommend the use of keys - maybe the user should pass
    options via the commandline.)
     
    Jason Cavett, Mar 7, 2007
    #2
    1. Advertising

  3. Aleksey Gureev

    Joe Attardi Guest

    On Mar 7, 12:34 pm, "Aleksey Gureev" <> wrote:
    > Imagine holding CTRL for the
    > complete database reset and ALT to call the configuration wizard.


    Do you hate your users, or something?
    Seriously though - that is not at all user friendly. How about
    automatically running the configuration wizard the first time the
    program is run, and after that it can just be accessed via a menu
    item? A database reset should definitely be a menu item, not triggered
    by a hotkey.

    Just my $0.02

    Joe
     
    Joe Attardi, Mar 7, 2007
    #3
  4. Guys,

    Very helpful so far! Is it a usability forum or something?

    > Do you hate your users, or something?
    > Seriously though - that is not at all user friendly.


    It shouldn't because it's a service function that I, as a developer
    and supporter, need to help a user in trouble to recover in a
    relatively easy way instead of telling something, like "go to that
    hidden folder in your home directory that Microsoft placed god knows
    where and remove that file". Shit happens and we need some "easter
    eggs" to help ourselves.

    > How about automatically running the configuration wizard the first time the
    > program is run, and after that it can just be accessed via a menu
    > item? A database reset should definitely be a menu item, not triggered
    > by a hotkey.


    The configuration wizard does run during the initial installation. I
    need to be able to re-run it at will without re-installing the
    application. And resetting the database should never be a menu item
    because it's something the user shouldn't bother about at all. If it
    is, it's the perfect timing for the developer to start looking for
    another job. Sorry if I touched someone's feelings. :)

    Please stop discussing the idea; it's just not worth your time. What's
    of real interest is the technical side of a problem. Currently, I
    can't see other way but the listener-method. It would be nice to get
    access to some keyboard state information though.

    Thanks,
    Al
     
    Aleksey Gureev, Mar 8, 2007
    #4
  5. Aleksey Gureev

    Jason Cavett Guest

    On Mar 8, 5:01 am, "Aleksey Gureev" <> wrote:
    > Guys,
    >
    > Very helpful so far! Is it a usability forum or something?
    >
    > > Do you hate your users, or something?
    > > Seriously though - that is not at all user friendly.

    >
    > It shouldn't because it's a service function that I, as a developer
    > and supporter, need to help a user in trouble to recover in a
    > relatively easy way instead of telling something, like "go to that
    > hidden folder in your home directory that Microsoft placed god knows
    > where and remove that file". Shit happens and we need some "easter
    > eggs" to help ourselves.
    >
    > > How about automatically running the configuration wizard the first time the
    > > program is run, and after that it can just be accessed via a menu
    > > item? A database reset should definitely be a menu item, not triggered
    > > by a hotkey.

    >
    > The configuration wizard does run during the initial installation. I
    > need to be able to re-run it at will without re-installing the
    > application. And resetting the database should never be a menu item
    > because it's something the user shouldn't bother about at all. If it
    > is, it's the perfect timing for the developer to start looking for
    > another job. Sorry if I touched someone's feelings. :)
    >
    > Please stop discussing the idea; it's just not worth your time. What's
    > of real interest is the technical side of a problem. Currently, I
    > can't see other way but the listener-method. It would be nice to get
    > access to some keyboard state information though.
    >
    > Thanks,
    > Al


    > It shouldn't because it's a service function that I, as a developer
    > and supporter, need to help a user in trouble to recover in a
    > relatively easy way instead of telling something, like "go to that
    > hidden folder in your home directory that Microsoft placed god knows
    > where and remove that file". Shit happens and we need some "easter
    > eggs" to help ourselves.


    Well...what happens if the user happens to accidentally press your
    "easter egg" key and does a database reset, resulting in them losing
    all their data. (And, of course, they won't know what happened.) You
    may say that will never happen, but then you would be underestimating
    what user's will try or accidentally do. Also, purposely programming
    in hidden features or an "easter egg" can really come back to bite you
    later...especially if the application is not well document.

    I agree with Joe here...I feel there's a more intuitive way to
    implement this.

    > The configuration wizard does run during the initial installation. I
    > need to be able to re-run it at will without re-installing the
    > application.


    Usually something like this is a trigger in a file. When the
    configuration wizard runs the first time, it sets a parameter in the
    config file and makes the "run_config" value a 0 instead of a 1,
    meaning "don't run the configuration wizard again." If you need to
    run it again, though, just change the value back.

    > Please stop discussing the idea; it's just not worth your time.


    To be fair - if you post up how you're doing something on Usenet, you
    can expect people (especially technical types) to analyze what you are
    doing. With that said...

    > What's of real interest is the technical side of a problem.


    I honestly don't think there's a way to capture key information before
    the application launches (except in your "kludge" method). I wouldn't
    put it in a splash screen, though. Have something that checks in
    between the splash screen and the actual start-up of the program to
    accomplish this (just don't show the component).

    Again, you may not find a lot of people who can help you with this
    problem as it's not one that should/will generally be tackled due
    other implementation possibilities.
     
    Jason Cavett, Mar 8, 2007
    #5
  6. Sorry for a long reply.

    > > It shouldn't because it's a service function that I, as a developer
    > > and supporter, need to help a user in trouble to recover in a
    > > relatively easy way instead of telling something, like "go to that
    > > hidden folder in your home directory that Microsoft placed god knows
    > > where and remove that file". Shit happens and we need some "easter
    > > eggs" to help ourselves.

    >
    > Well...what happens if the user happens to accidentally press your
    > "easter egg" key and does a database reset, resulting in them losing
    > all their data. (And, of course, they won't know what happened.) You
    > may say that will never happen, but then you would be underestimating
    > what user's will try or accidentally do. Also, purposely programming
    > in hidden features or an "easter egg" can really come back to bite you
    > later...especially if the application is not well document.
    >
    > I agree with Joe here...I feel there's a more intuitive way to
    > implement this.


    Right, it's dangerous to some extent. Hmmm

    > > The configuration wizard does run during the initial installation. I
    > > need to be able to re-run it at will without re-installing the
    > > application.

    >
    > Usually something like this is a trigger in a file. When the
    > configuration wizard runs the first time, it sets a parameter in the
    > config file and makes the "run_config" value a 0 instead of a 1,
    > meaning "don't run the configuration wizard again." If you need to
    > run it again, though, just change the value back.


    Yeah, but I also think how am I supposed to explain to a user-in-
    trouble where to find a config file (or a key in Win registry) and how
    to edit it. Another pain in the neck, I would say.

    > > Please stop discussing the idea; it's just not worth your time.

    >
    > To be fair - if you post up how you're doing something on Usenet, you
    > can expect people (especially technical types) to analyze what you are
    > doing. With that said...


    I didn't mean to stop this discussion at all. Let me explain. I'm
    under the strict time limits (who isn't) and if I write something to
    Usenet, I know I tried everything else, Googled, performed other
    research etc. So I expect people to be concise and constructive.
    Instead, after a day of waiting, I get criticism with absolutely no
    answers to my questions. What would be your reaction to this?
    (rhetorical question)

    > > What's of real interest is the technical side of a problem.

    >
    > I honestly don't think there's a way to capture key information before
    > the application launches (except in your "kludge" method). I wouldn't
    > put it in a splash screen, though. Have something that checks in
    > between the splash screen and the actual start-up of the program to
    > accomplish this (just don't show the component).


    Right. I don't like it too.

    > Again, you may not find a lot of people who can help you with this
    > problem as it's not one that should/will generally be tackled due
    > other implementation possibilities.


    Yeah. Still I don't see a user-safe, developer-friendly method of
    calling the list of service functions during the startup

    a. without editing a file
    b. without any visible GUI commands / options

    The special stress is on (b) because when the DB is corrupted and I
    need to reset it, the application won't start to give me any GUI with
    commands / options. That's why I need something that could be invoked
    during the initial startup phase.

    Anyway, thanks for all bright ideas voiced and sorry if I offended
    anyone! I really appreciate any help.

    - Al
     
    Aleksey Gureev, Mar 8, 2007
    #6
  7. Aleksey Gureev

    Jason Cavett Guest

    On Mar 8, 10:37 am, "Aleksey Gureev" <> wrote:
    > Sorry for a long reply.
    >
    >
    >
    >
    >
    > > > It shouldn't because it's a service function that I, as a developer
    > > > and supporter, need to help a user in trouble to recover in a
    > > > relatively easy way instead of telling something, like "go to that
    > > > hidden folder in your home directory that Microsoft placed god knows
    > > > where and remove that file". Shit happens and we need some "easter
    > > > eggs" to help ourselves.

    >
    > > Well...what happens if the user happens to accidentally press your
    > > "easter egg" key and does a database reset, resulting in them losing
    > > all their data. (And, of course, they won't know what happened.) You
    > > may say that will never happen, but then you would be underestimating
    > > what user's will try or accidentally do. Also, purposely programming
    > > in hidden features or an "easter egg" can really come back to bite you
    > > later...especially if the application is not well document.

    >
    > > I agree with Joe here...I feel there's a more intuitive way to
    > > implement this.

    >
    > Right, it's dangerous to some extent. Hmmm
    >
    > > > The configuration wizard does run during the initial installation. I
    > > > need to be able to re-run it at will without re-installing the
    > > > application.

    >
    > > Usually something like this is a trigger in a file. When the
    > > configuration wizard runs the first time, it sets a parameter in the
    > > config file and makes the "run_config" value a 0 instead of a 1,
    > > meaning "don't run the configuration wizard again." If you need to
    > > run it again, though, just change the value back.

    >
    > Yeah, but I also think how am I supposed to explain to a user-in-
    > trouble where to find a config file (or a key in Win registry) and how
    > to edit it. Another pain in the neck, I would say.
    >
    > > > Please stop discussing the idea; it's just not worth your time.

    >
    > > To be fair - if you post up how you're doing something on Usenet, you
    > > can expect people (especially technical types) to analyze what you are
    > > doing. With that said...

    >
    > I didn't mean to stop this discussion at all. Let me explain. I'm
    > under the strict time limits (who isn't) and if I write something to
    > Usenet, I know I tried everything else, Googled, performed other
    > research etc. So I expect people to be concise and constructive.
    > Instead, after a day of waiting, I get criticism with absolutely no
    > answers to my questions. What would be your reaction to this?
    > (rhetorical question)
    >
    > > > What's of real interest is the technical side of a problem.

    >
    > > I honestly don't think there's a way to capture key information before
    > > the application launches (except in your "kludge" method). I wouldn't
    > > put it in a splash screen, though. Have something that checks in
    > > between the splash screen and the actual start-up of the program to
    > > accomplish this (just don't show the component).

    >
    > Right. I don't like it too.
    >
    > > Again, you may not find a lot of people who can help you with this
    > > problem as it's not one that should/will generally be tackled due
    > > other implementation possibilities.

    >
    > Yeah. Still I don't see a user-safe, developer-friendly method of
    > calling the list of service functions during the startup
    >
    > a. without editing a file
    > b. without any visible GUI commands / options
    >
    > The special stress is on (b) because when the DB is corrupted and I
    > need to reset it, the application won't start to give me any GUI with
    > commands / options. That's why I need something that could be invoked
    > during the initial startup phase.
    >
    > Anyway, thanks for all bright ideas voiced and sorry if I offended
    > anyone! I really appreciate any help.
    >
    > - Al- Hide quoted text -
    >
    > - Show quoted text -


    > (b) because when the DB is corrupted and I
    > need to reset it, the application won't start to give me any GUI with
    > commands / options.


    Ooo...I see. That's crummy. So, basically, the GUI is dependent upon
    the database being correct - whatever correct may be?

    Another alternative - create a second "admin" program that does the
    things you want it to do (and can be done in a graphical way).

    Also, like I said in my original post, how hard would it be to have
    the user provide command line arguments? Not only is this already
    supported (via the main method entry point), it's also very easy to
    code and will be there before any GUI initialization. Since it sounds
    like what you are doing is kind of kludgy to begin with, this really
    isn't any worse of an idea, and, again is pretty easy to implement.

    Good luck.
     
    Jason Cavett, Mar 8, 2007
    #7
  8. Aleksey Gureev

    Joe Attardi Guest

    On Mar 8, 5:01 am, "Aleksey Gureev" <> wrote:
    > Very helpful so far! Is it a usability forum or something?

    Not primarily, but when designing an approach to solving a problem in
    software, usability should always be a top concern.

    > It shouldn't because it's a service function that I, as a developer
    > and supporter, need to help a user in trouble to recover in a
    > relatively easy way instead of telling something, like "go to that
    > hidden folder in your home directory that Microsoft placed god knows
    > where and remove that file".

    Which is why it is the most intuitive to have an "Advanced" tab in the
    configuration dialog, containing all of these things.

    Also, the other approaches suggested by other posters here are also
    great approaches..

    - a separate admin/support utility that can be run if the database
    gets trashed: Microsoft has something similar for Outlook - if a PST
    file gets corrupted, there is an "Inbox Repair Tool" that you can run
    that can correct errors and restore your PST file to a usable state
    again.

    - command-line arguments
     
    Joe Attardi, Mar 8, 2007
    #8
  9. Aleksey Gureev

    Lew Guest

    Aleksey Gureev wrote:
    > I didn't mean to stop this discussion at all. Let me explain. I'm
    > under the strict time limits (who isn't) and if I write something to
    > Usenet, I know I tried everything else, Googled, performed other
    > research etc. So I expect people to be concise and constructive.
    > Instead, after a day of waiting, I get criticism with absolutely no
    > answers to my questions. What would be your reaction to this?
    > (rhetorical question)


    To get over it (non-rhetorical answer).

    People are not here to live up to your expectations. Nor are people here to
    help with your problems.

    -- Lew
     
    Lew, Mar 9, 2007
    #9
  10. > Ooo...I see. That's crummy. So, basically, the GUI is dependent upon
    > the database being correct - whatever correct may be?


    Yes, sort of.

    > Another alternative - create a second "admin" program that does the
    > things you want it to do (and can be done in a graphical way).


    Oh. Nice shot! I've never thought about it.

    > Also, like I said in my original post, how hard would it be to have
    > the user provide command line arguments? Not only is this already
    > supported (via the main method entry point), it's also very easy to
    > code and will be there before any GUI initialization. Since it sounds
    > like what you are doing is kind of kludgy to begin with, this really
    > isn't any worse of an idea, and, again is pretty easy to implement.


    The problem is that this is the WebStart application, so no command
    line. :(

    > Good luck.


    Thanks, that idea with the helper application is very nice.

    -- Al
     
    Aleksey Gureev, Mar 9, 2007
    #10
  11. > > Very helpful so far! Is it a usability forum or something?
    >
    > Not primarily, but when designing an approach to solving a problem in
    > software, usability should always be a top concern.


    Sure. I explained it a bit above -- it was just the wrong timing and
    quite unexpected.

    > > It shouldn't because it's a service function that I, as a developer
    > > and supporter, need to help a user in trouble to recover in a
    > > relatively easy way instead of telling something, like "go to that
    > > hidden folder in your home directory that Microsoft placed god knows
    > > where and remove that file".

    >
    > Which is why it is the most intuitive to have an "Advanced" tab in the
    > configuration dialog, containing all of these things.
    >
    > Also, the other approaches suggested by other posters here are also
    > great approaches..
    >
    > - a separate admin/support utility that can be run if the database
    > gets trashed: Microsoft has something similar for Outlook - if a PST
    > file gets corrupted, there is an "Inbox Repair Tool" that you can run
    > that can correct errors and restore your PST file to a usable state
    > again.
    >
    > - command-line arguments


    Right, the utility application sounds like a good option. The command-
    line won't work (see above).

    Thanks!

    -- Al
     
    Aleksey Gureev, Mar 9, 2007
    #11
  12. > > I didn't mean to stop this discussion at all. Let me explain. I'm
    > > under the strict time limits (who isn't) and if I write something to
    > > Usenet, I know I tried everything else, Googled, performed other
    > > research etc. So I expect people to be concise and constructive.
    > > Instead, after a day of waiting, I get criticism with absolutely no
    > > answers to my questions. What would be your reaction to this?
    > > (rhetorical question)

    >
    > To get over it (non-rhetorical answer).
    >
    > People are not here to live up to your expectations.


    How is that? How can I post a question and don't expect the answer?
    I'm sorry, but there's a flaw in the statement. In this context I'm
    afraid of giving any bits of advices, but at least respect the time of
    the opponent and they'll respect yours.

    > Nor are people here to help with your problems.


    Then why? :) I thought it's the right place to post when you are in
    trouble and expect someone share his/her wisdom. Maybe we just have
    different perspectives on this?

    Anyway, thanks for sharing your standpoint. Appreciated.

    -- Al

    P.S. I'm not going to waste any time speculating on the moral side of
    the Usenet, as I'm obviously not in my field here. So, please leave it
    alone. For those who still feel offended my sincere apologies.
     
    Aleksey Gureev, Mar 9, 2007
    #12
  13. Aleksey Gureev

    Lew Guest

    Aleksey Gureev wrote:
    >>> I didn't mean to stop this discussion at all. Let me explain. I'm
    >>> under the strict time limits (who isn't) and if I write something to
    >>> Usenet, I know I tried everything else, Googled, performed other
    >>> research etc. So I expect people to be concise and constructive.
    >>> Instead, after a day of waiting, I get criticism with absolutely no
    >>> answers to my questions. What would be your reaction to this?
    >>> (rhetorical question)


    Lew wrote:
    >> To get over it (non-rhetorical answer).
    >>
    >> People are not here to live up to your expectations.


    Aleksey Gureev wrote:
    > How is that? How can I post a question and don't expect the answer?


    I'm afraid you cannot /expect/ any answer. This is a discussion group, not a
    help desk. No one is obligated to answer you at all, much less how you want
    them to.

    > I'm sorry, but there's a flaw in the statement. In this context I'm
    > afraid of giving any bits of advices, but at least respect the time of
    > the opponent and they'll respect yours.


    "Opponent"? What is the flaw? I aver that it is your expectation that people
    are obligated to help anyone here.

    >> Nor are people here to help with your problems.

    >
    > Then why? :) I thought it's the right place to post when you are in
    > trouble and expect someone share his/her wisdom. Maybe we just have
    > different perspectives on this?


    It is the right place to post, just not to expect answers. Yes, the odds are
    you will get answers, but many of them will be wrong or off purpose from your
    point of view. By the same token, answers that may seem to be off purpose
    could actually provide you with much more insight if you take the care to
    understand them.

    > Anyway, thanks for sharing your standpoint. Appreciated.


    You are most welcome.

    > P.S. I'm not going to waste any time speculating on the moral side of
    > the Usenet, as I'm obviously not in my field here. So, please leave it
    > alone. For those who still feel offended my sincere apologies.


    This has nothing to do with morality. People aren't here to live up to my
    expectations or help with my problems either. People are here to discuss the
    world of Java programming, and often volunteer to help each other. It is the
    expectation of any answer, much less a quick or accurate one, that is flawed.

    There is a practical side. If one is impatient or demanding one may expect
    much less useful responses. To go back to the original point - if one don't
    like the responses one gets on Usenet, one should get over it. Just like any
    other discussion, the subject will wander and people will often disagree or
    get it wrong or take their time to respond or flame the group or ...

    -- Lew
     
    Lew, Mar 9, 2007
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shila
    Replies:
    3
    Views:
    682
    Tor Iver Wilhelmsen
    Feb 24, 2004
  2. Razvan
    Replies:
    11
    Views:
    924
    Andrew Thompson
    Jul 17, 2004
  3. Indudhar
    Replies:
    4
    Views:
    376
    Patrick May
    Oct 21, 2005
  4. Tony Morris

    Local Classes - Access Modifiers?

    Tony Morris, Jan 14, 2006, in forum: Java
    Replies:
    10
    Views:
    938
    Stefan Schulz
    Jan 16, 2006
  5. Miquel

    Class & modifiers modifiers

    Miquel, Jan 25, 2007, in forum: Ruby
    Replies:
    4
    Views:
    177
    Miquel
    Jan 26, 2007
Loading...

Share This Page