disposing a jframe from keyboard

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pankajs
    New Member
    • Mar 2008
    • 36

    disposing a jframe from keyboard

    how can i dispose a JFrame from keyboard.???
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by pankajs
    how can i dispose a JFrame from keyboard.???
    I don't understand your question: a JFrame is supposed to be displayed on your
    screen, not on your keyboard. Did it fall off?

    kind regards,

    Jos

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Originally posted by JosAH
      I don't understand your question: a JFrame is supposed to be displayed on your
      screen, not on your keyboard. Did it fall off?

      kind regards,

      Jos
      You are supposed to guess that they want to close the JFrame using a keyevent.


      P.S If the JFrame falls of my screen, it won"t fall on my keyboard too. They are about 10 cm apart.

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by r035198x
        You are supposed to guess that they want to close the JFrame using a keyevent.


        P.S If the JFrame falls of my screen, it won"t fall on my keyboard too. They are about 10 cm apart.
        I have a laptop so if a JFrame falls off my screen it slides down on the keyboard;
        if my keyboard happens to be a bit slippery it'll slide even further and drops down
        off the table in my lap *yuck*. I'll go and implement a fast SuperGlue class now ...

        kind regards,

        Jos ;-)

        Comment

        • pankajs
          New Member
          • Mar 2008
          • 36

          #5
          I was meant to say that there is method setCloseDefault CloseOperation( DISPOSE_ON_CLOS E); ie. when we click close at right top it closed.My ques. was how can it be done by keyevent??????

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #6
            Originally posted by pankajs
            I was meant to say that there is method setCloseDefault CloseOperation( DISPOSE_ON_CLOS E); ie. when we click close at right top it closed.My ques. was how can it be done by keyevent??????
            The first step is to read about the subject.

            Comment

            • pankajs
              New Member
              • Mar 2008
              • 36

              #7
              I was meant to say that there is method setCloseDefault CloseOperation( DISPOSE_ON_CLOS E); ie. when we click close at right top it closed.My ques. was how can it be done by keyevent??????

              i couldn't find any solutn.. Please..

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #8
                Originally posted by pankajs
                I was meant to say that there is method setCloseDefault CloseOperation( DISPOSE_ON_CLOS E); ie. when we click close at right top it closed.My ques. was how can it be done by keyevent??????

                i couldn't find any solutn.. Please..
                Did you read my reply above?

                Comment

                • BigDaddyLH
                  Recognized Expert Top Contributor
                  • Dec 2007
                  • 1216

                  #9
                  Usually, if you want to provide the user with a close action, you create a "close" menu item. Then the keyboard binding follows from the menu item's accelerator:

                  This Swing Java Tutorial describes developing graphical user interfaces (GUIs) for applications and applets using Swing components

                  Comment

                  Working...