Results 1 to 2 of 2
  1. #1
    cbalu is offline Member
    Join Date
    Nov 2007
    Rep Power

    Default Strange behaviour in swing

    Hi folks,
    Today i noticed two strange behaviour in swing.
    Case 1: Normally for every key events we used to get one keyPress and one keyRelease events.But this is not of the case with PrintScreen key. I tested this behaviour on the JNLP file used in java tutorial at this link itself.

    Question: Why only PrintScreen has this kind of event associated with it?

    Case 2: One more thing is that whenever we create a JMenu component on the JFrame we are able to access this menu by Left-Clicking on the JMenu component but accidentally i made a right click on the JMenu and that too populates the JMenu.

    Question: How can i restrict Right-Clicking on the JMenu Component?

    Image for your reference
    1.JNLP file under my PC

    Can anybody help????:eek::eek::eek:
    Last edited by cbalu; 05-22-2008 at 02:22 PM. Reason: Added link

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Rep Power


    How can i restrict Right-Clicking on the JMenu Component?
    SwingUtilities has handy methods such as isRightMouseButton

Similar Threads

  1. Need help on a strange file access prob
    By squad in forum Advanced Java
    Replies: 0
    Last Post: 03-21-2008, 11:55 AM
  2.; strange error!
    By kantze in forum New To Java
    Replies: 2
    Last Post: 03-19-2008, 02:44 PM
  3. Strange error message "Source not found"
    By ppayal in forum Eclipse
    Replies: 0
    Last Post: 11-25-2007, 07:19 PM
  4. Un expected behaviour when reading from inputstream
    By adoorsarath in forum Advanced Java
    Replies: 3
    Last Post: 08-10-2007, 06:02 PM
  5. map javax.swing.text.Element to javax.swing.text.View
    By elizabeth in forum New To Java
    Replies: 1
    Last Post: 07-30-2007, 08:02 PM

Posting Permissions

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