Results 1 to 5 of 5
  1. #1
    dbashby's Avatar
    dbashby is offline Senior Member
    Join Date
    Mar 2009
    Posts
    223
    Rep Power
    6

    Question Simplified explanation of Mnemonic

    I have this piece of code, it works. However I do not understand it, it works but I need to understand it.
    Could somebody give me a fairly simple explanation.

    Java Code:
    jRmetric.setMnemonic(KeyEvent.VK_B); // resets metric as default
                        jRmetric.setActionCommand(metric);
                        jRmetric.setSelected(true);
                            optPane1.showMessageDialog(this,"Measurements have   been reset to metric \n" + "enter your height in Cm's and your weight in Kg's",
                                     "Re-set to metric",optPane1.ERROR_MESSAGE);

  2. #2
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    6

    Default

    mnemonic is like when you press alt f and get to the file menu. or alt h to get to help. basically that underlined letter on menus, buttons, etc. i think...

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Have you gone through the Sun Swing Button tutorial yet? It discusses mnemonics as does the AbstractButton API.

  4. #4
    dbashby's Avatar
    dbashby is offline Senior Member
    Join Date
    Mar 2009
    Posts
    223
    Rep Power
    6

    Question

    I have gone through it but I need plain english so that I understand each line of code, in the tutorials they do not explain it in a simplified way.

    This is the first time I have come accross this code and put it together without understanding it.

    I want to comment each line of code.

    Thanks for the information though but I hope someone will just give me a simple explanation.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default

    Ever thought of reading the API for the method? I don't think it gets any plainer than that.

    AbstractButton#setMnemonic
    ... The mnemonic is the key which when combined with the look and feel's mouseless modifier (usually Alt) will activate this button if focus is contained somewhere within this button's ancestor window. ...

    db

Similar Threads

  1. Quick Sort explanation.
    By hawaiifiver in forum New To Java
    Replies: 4
    Last Post: 03-10-2009, 02:28 AM
  2. How to use Mnemonic for CheckBoxes
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-27-2008, 07:45 PM
  3. Class explanation
    By mcal in forum New To Java
    Replies: 1
    Last Post: 02-05-2008, 06:50 PM
  4. need a little explanation
    By cew27 in forum New To Java
    Replies: 7
    Last Post: 12-13-2007, 11:39 PM
  5. I need didactic explanation
    By Eric in forum New To Java
    Replies: 2
    Last Post: 07-02-2007, 05:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •