close swing form application

Discussion in 'Java' started by column, Jun 19, 2008.

  1. column

    column Guest

    Hello,

    What is the correct way to close java visual aplication based on swing
    components. I would like to do this using jMenuItem. I use NetBeans
    IDE

    Thank you
     
    column, Jun 19, 2008
    #1
    1. Advertising

  2. On Jun 20, 3:24 am, column <> wrote:

    > What is the correct way to close java visual aplication based on swing
    > components.


    Java and Swing are proper names, hence upper
    case first letter.

    Please be very specific about these matters,
    instead of 'talking like your IDE'.

    >..I would like to do this using jMenuItem.


    There is no such class in the J2SE. Did you
    mean a JMenuItem?

    >..I use NetBeans IDE


    Yes.. If you used *Java* you would probably
    already have found the JavaDocs, and
    answered your own question.

    If you mean JFrame/JMenuItem..
    - add an ActionListener to the menu item.
    - In the actionPerformed(ActionEvent) method,
    call JFrame.setVisible(boolean).
    - Since the default behaviour of a JFrame is to
    hide it when the user clicks the 'close button'
    in the JFrame, you will also need to call the
    setDefaultCloseOperation(int) with an appropriate
    value.

    --
    Andrew Thompson
    http://pscode.org/
     
    Andrew Thompson, Jun 19, 2008
    #2
    1. Advertising

  3. column

    Lew Guest

    Andrew Thompson wrote:
    > Java and Swing are proper names, hence upper
    > case first letter.


    "Java" is a trademark, not a proper noun. As Sun explains on
    <http://www.sun.com/policies/trademarks/>
    > Trademarks are adjectives.
    > Use them, at least in your initial and most prominent references and otherwise as needed for clarity,
    > with generic nouns that identify a Sun product, technology, program, or service.
    > For example, use "Java technology" or "the Solaris operating system" instead of using "Java" or
    > "Solaris" on its own.


    However, you are absolutely correct that "Java", as a trademark, must
    be spelled with an upper-case "J".

    --
    Lew
     
    Lew, Jun 19, 2008
    #3
  4. column

    Mark Space Guest

    Lew wrote:
    > Andrew Thompson wrote:
    >> Java and Swing are proper names, hence upper
    >> case first letter.

    >
    > "Java" is a trademark, not a proper noun. As Sun explains on
    > <http://www.sun.com/policies/trademarks/>
    >> Trademarks are adjectives.
    >> Use them, at least in your initial and most prominent references and otherwise as needed for clarity,
    >> with generic nouns that identify a Sun product, technology, program, or service.
    >> For example, use "Java technology" or "the Solaris operating system" instead of using "Java" or
    >> "Solaris" on its own.

    >
    > However, you are absolutely correct that "Java", as a trademark, must
    > be spelled with an upper-case "J".
    >
    > --
    > Lew


    Similar info here:

    http://www.accessmylibrary.com/coms2/summary_0286-21206027_ITM


    "Trademarks are proper adjectives, never nouns, and at least once in
    every context in which they appear trademarks should be followed by, and
    modify, the generic names of the goods and services they identify."

    Note that proper adjectives are capitalized, just like proper nouns.
    Eg., "the English language." Good stuff, I didn't know that trademarks
    are "proper adjectives" and I consider myself a bit of an English
    language maven too.
     
    Mark Space, Jun 19, 2008
    #4
  5. Andrew Thompson wrote:
    > On Jun 20, 3:24 am, column <> wrote:
    >
    >> What is the correct way to close java visual aplication based on swing
    >> components.

    >
    > Java and Swing are proper names, hence upper
    > case first letter.
    >
    > Please be very specific about these matters,
    > instead of 'talking like your IDE'.
    >
    >> ..I would like to do this using jMenuItem.

    >
    > There is no such class in the J2SE. Did you
    > mean a JMenuItem?
    >
    >> ..I use NetBeans IDE

    >
    > Yes.. If you used *Java* you would probably
    > already have found the JavaDocs, and
    > answered your own question.
    >
    > If you mean JFrame/JMenuItem..
    > - add an ActionListener to the menu item.
    > - In the actionPerformed(ActionEvent) method,
    > call JFrame.setVisible(boolean).
    > - Since the default behaviour of a JFrame is to
    > hide it when the user clicks the 'close button'
    > in the JFrame, you will also need to call the
    > setDefaultCloseOperation(int) with an appropriate
    > value.
    >
    > --
    > Andrew Thompson
    > http://pscode.org/


    An alternate option to Andrew's excellent suggestion, is to dispose()
    all windows and the program should exit on its own (assuming there are
    no other threads running that are keeping it going).

    --

    Knute Johnson
    email s/nospam/knute2008/

    --
    Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
    ------->>>>>>http://www.NewsDemon.com<<<<<<------
    Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
     
    Knute Johnson, Jun 20, 2008
    #5
  6. On Jun 20, 9:22 am, Knute Johnson <>
    wrote:
    ...
    > An alternate option ... is to dispose()
    > all windows and the program should exit on its own (assuming there are
    > no other threads running that are keeping it going).


    'Should', yes. But I have found a number of
    situations where the JRE/Sun APIs tend to make
    'go on forever' threads. JavaSound is (or at
    least was) notorious for it.

    As a safeguard, I would also recommend (in
    addition to Knute's excellent alternative)
    explicitly calling System.exit(int) on the
    'root' JFrame.

    --
    Andrew Thompson
    http://pscode.org/
     
    Andrew Thompson, Jun 20, 2008
    #6
  7. column

    Roedy Green Guest

    On Thu, 19 Jun 2008 10:24:24 -0700 (PDT), column
    <> wrote, quoted or indirectly quoted someone
    who said :

    >What is the correct way to close java visual aplication based on swing
    >components. I would like to do this using jMenuItem. I use NetBeans
    >IDE


    I posted code yesterday for Hybrid for AWT and Swing that has the
    shutdown code.
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Jun 20, 2008
    #7
  8. On Jun 21, 1:47 pm, Lew <> wrote:
    ...
    > However, in the vernacular "Java" is a proper noun.  


    However, in the ocean "Java" is an island.
    <http://en.wikipedia.org/wiki/Java>

    It still irritates me that American(?) slang for
    coffee, and then Sun, effectively stole the name
    of an existing place.

    >..  Yet Sun has refrained from suing us over that.


    Maybe the island should sue ..someone.

    --
    Andrew T.
     
    Andrew Thompson, Jun 21, 2008
    #8
  9. column

    Mark Space Guest

    Lew wrote:
    > Mark Space wrote:
    >> Similar info here:
    >>
    >> http://www.accessmylibrary.com/coms2/summary_0286-21206027_ITM


    >
    > However, in the vernacular "Java" is a proper noun. I don't think I see
    > one place in a hundred that uses the word "Java" and "at least once in
    > every context ... [is] followed by ... the generic name" of whatever.
    > Yet Sun has refrained from suing us over that.
    >


    It should probably be "the Java language" but you're right, Sun seems to
    use it as a noun. Sun also doesn't list Java with a TM symbol on their
    front page, you have to click on a link to see their list of trademarks.

    The link above talks about the importance of using trademarks properly,
    lest the owner loose them. ("Ping pong" ... Wikipedia doesn't even list
    an entry for the trademark name.) I can't help but think Sun maybe
    flirting with disaster to not use their mark properly, but I guess they
    have their own legal council.
     
    Mark Space, Jun 21, 2008
    #9
  10. column

    Neil Coffey Guest

    Lew wrote:
    > Mark Space wrote:


    >> Note that proper adjectives are capitalized, just like proper nouns.
    >> Eg., "the English language." Good stuff, I didn't know that
    >> trademarks are "proper adjectives" and I consider myself a bit of an
    >> English language maven too.

    >
    > However, in the vernacular "Java" is a proper noun. I don't think I see
    > one place in a hundred that uses the word "Java" and "at least once in
    > every context ... [is] followed by ... the generic name" of whatever.
    > Yet Sun has refrained from suing us over that.


    Linguists don't have a single, clear-cut, universally agreed
    upon definition of "adjective" (let alone "proper adjective").
    If there was ever a court case involving whether a given usage
    constituted a "proper adjective" and there was a syntactician
    present (which clearly there wasn't when this law was drawn up),
    then I think just about anything could get argued.

    FWIW, my personal viewpoint is that "Java" pretty much has
    to be a noun. In cases such as "Java language", "Java" is still
    a noun -- and you have a noun+noun compound. (Consider, for example,
    that it's not grammatical to say "*the Java language and the C++ one",
    but it is grammatical to say "the object-oriented language and the
    procedural one".)

    Neil
     
    Neil Coffey, Jun 24, 2008
    #10
    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. Big Daddy

    Java 1.2 Swing vs. Java 1.5 Swing

    Big Daddy, Apr 15, 2005, in forum: Java
    Replies:
    2
    Views:
    505
    Pete Barrett
    Apr 16, 2005
  2. mkrause
    Replies:
    0
    Views:
    676
    mkrause
    May 6, 2005
  3. lizard
    Replies:
    0
    Views:
    1,775
    lizard
    Jan 30, 2006
  4. S.T
    Replies:
    2
    Views:
    587
  5. Iñaki Baz Castillo
    Replies:
    7
    Views:
    879
    Iñaki Baz Castillo
    Jan 12, 2010
Loading...

Share This Page