How to activate a JButton with right-click?

If I create a JButton and add an ActionListener, I can activate the button with a mouse left-click but not with a mouse right-click.
I've looked at other posts related to this topic. Some people have said that the default is that either a left- or right-click will activate a JButton but I can't get this to happen.
If I add a MouseListener to the button, I get mouse events for both left and right clicks (in mousePressed() for instance) but only the left-click goes on to activate the JButton.
I'm using Java 1.4 with Windows 2000.
Thanks in advance for any help.
-Rick

I use Windows 98, that's what I get too. I'm pretty sure that's normal behavior. If you want right clicks to be processed as well, use this code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class BothClick extends JFrame implements MouseListener
    JButton clickMe;
    public BothClick()
        super("Test");
        setSize(300, 300);
        clickMe = new JButton("Click Me");
        getContentPane().setLayout(new FlowLayout());
        getContentPane().add(clickMe);
        clickMe.addMouseListener(this);
        setVisible(true);
    public void mousePressed(MouseEvent e)
        clickMe.doClick();
    public void mouseReleased(MouseEvent e) {}
    public void mouseEntered(MouseEvent e) {}
    public void mouseExited(MouseEvent e) {}
    public void mouseClicked(MouseEvent e) {}
    public static void main(String[] args)
        new BothClick();
}

Similar Messages

  • How to Remove "OLAP Functions with right-click" in Workbooks (By VBA?)

    Dear Experts:
    After we created workbooks, to prevent end users from using certain BEx functions, we greyed out some "icons"
    on SAP BEx Menu in the workbooks. But now we have one problems: because we also made "Setting" unable on the menu bar, now we are not able to remove one marked selection: "OLAP Functions with right-click". Is there any way we can disable "OLAP Functions with right-click", then users can only use the normal Excel functions in the workbooks??
    Thank you very much and BR
    SzuFen

    Hello,
    Go to Business Explorer Menu, Select Settings, Uncheck OLAP Function with Right Click and save it as existing workbook.
    I have tried it. It works, when you reopen, it will be still disable..
    Hope it helps.
    San.
    Message was edited by: SAN

  • Email Security Plug-in - Doesn't seem to work with right click or save and send

    I've searched the knowledge base but have not located the answer yet.
    We have the Encrypt Message plug-in installed to flag the email [SEND SECURE].  This works very well when in Outlook.  It does not seem to work when right clicking a file to send outside of Outlook or performing Save and Send from within Microsoft Office.  The add-in still shows and users are clicking it and the Send button but the emails are not going securely.  We are on Microsoft2010 on mostly XP machines.
    How can I get Encrypt Message to work in all instances?
    Thank you.
    Starla

    Andreas
    I am getting an error.  See below for what I'm choosing and the response.  let me know if I'm supposed to be trying to download from another area.
    Thanks
    Starla
    Email Security Plug-in - Doesn't seem to work with right click or save and send
    Cisco IronPort Email Security Appliance C370
    Release:IPAS
    Filename: CiscoEmailSecurity_7-2-0-039.exe
      Remove
    Details
    Release
    IPAS
    Filename
    CiscoEmailSecurity_7-2-0-039.exe
    Release Date
    25/Oct/2011
    Description
    Cisco IronPort Email Security Plug-in (Outlook)
    Size
    32541.84375 KB (33322848 bytes)
    Router Checksum
    0x553f
    MD5
    f0c864697d9e1a3e8f5297062943ac50
    Email Security Plug-in - Doesn't seem to work with right click or save and send
    Save the device to 'My Added Devices' list
    More Info
    'My Added Devices' list could be found by: 1. Clicking on 'My Cisco' Tab and expanding
        the 'Added Devices' section. 2. Selecting any task specific product
       selector and clicking on 'My Added
        Devices' in left pane.
    Email Security Plug-in - Doesn't seem to work with right click or save and send
    Set Cisco Notification Alert
    More Info
    All 'Cisco Notification Alerts' list could be found
    by: 1. Clicking on 'My Cisco' Tab and expanding
        the 'Support Notifications' section.
    Cisco service contract information indicates you are not authorized to download software for the following product(s):
    Cisco IronPort Email Security Appliance C170
    Cisco IronPort Email Security Appliance C370
    Cisco IronPort Email Security Appliance C650
    To download software for other product(s), remove the software for the product(s) listed above.
    Or, if you feel this message is in error, please:
    1. Email technical support for 24x7 assistance. To expedite your request, please include the following information:
             User ID (Cisco.com ID used to download software)
             Contact Name
             Company Name
             Contract Number
             Product ID
             Desired Software Release or File Name
    2. Contact your Cisco Representative, Partner or Reseller to ensure product(s) listed above are covered on a service contract. The Partner Locator link may assist in locating your nearest partner.
    3. Associate contracts for those products to your Cisco.com profile using the Instructions found in Profile Manager. After you submit your additional contracts, verification and updates may take up to 6 hours to complete.

  • How can I remove the default right click option of the text Area control?

    How can I remove the default right click option of the text Area control?
    Is there any way to disable this control in any of the text controls available?

    The iPhone does not store email addresses for received mail. The iPhone stores all email addressees for sent mail in a list of previous recipients. The list of previous recipients is not synced with Outlook or any address book, but the list of previous recipients is included with the iPhone's backup which is updated by iTunes as the first step during the iTunes sync process. The auto-addrss feature pulls from your contacts on the iPhone and from the list of previous recipients.
    Different from the Mail.app on a Mac, there is no access to the list of previous recipients on the iPhone to remove a previous recipient from the list, or to add a previous recipient to contacts that is not already entered - not at the present time anyway.
    The only way to purge the existing list at the present time is by restoring your iPhone with iTunes as a new iPhone or not from your iPhone's backup.
    Hopefully access to the list of previous recipients will be included with the iOS 5 update.

  • Deactive OLAP functions with right click

    Hi guys,
    I want to deactive "OLAP functions with right click" in thw workbooks to avoid some mis-operations from users. I tried to uncheck it from BEx toolbar (under "Settings") and saved the workbook. But when I reopen the workbook, it becomes active again. Does anyone know how to deactive it forever? Thanks a lot.

    Hello,
    Go to Business Explorer Menu, Select Settings, Uncheck OLAP Function with Right Click and save it as existing workbook.
    I have tried it. It works, when you reopen, it will be still disable..
    Hope it helps.
    San.
    Message was edited by: SAN

  • How to call a form with dabble clicking on a record with one time where

    Hi All,
    How to call a form with dabble clicking on a record with one time where clause. I mean when i dabble click on the current record i want to call another form with details of the
    record with onetime where clause. Can anyone help me in this regard.
    Now i am calling a form with parameter with onetime where but this should avoid.
    Thanks in advance
    Arif

    Hello,
    I mistakenly mark it as solved. There is a problem remain. when i placed the code below it do not execute with the where condition. I mean the condition to execute is not work.
    All records executes. Please correct my code--
    Here the WHEN-BUTTON-PRESSED-trigger on the Edit-Button:
    :GLOBAL.MODE:='EDIT';
    :GLOBAL.REQ_ID:=:PROBLEM_REQUEST.REQ_ID;
    CALL_FORM('REQUEST_ID_PARAM',NO_HIDE,DO_REPLACE,NO_QUERY_ONLY);And also, WHEN-NEW-FORM-INSTANCE-trigger of REQUEST_ID_PARAM:
    DEFAULT_VALUE(NULL, 'GLOBAL.MODE');
    DEFAULT_VALUE(NULL, 'GLOBAL.REQ_ID');
    IF :GLOBAL.MODE='EDIT' THEN
    GO_BLOCK('PROBLEM_REQUEST');
    EXECUTE_QUERY;
    SET_BLOCK_PROPERTY('PROBLEM_REQUEST', INSERT_ALLOWED, PROPERTY_FALSE);
    END IF;Arif

  • Hi there, can anyone tell me how to activate my iphone with 2g network?

    hi there, can anyone tell me how to activate my iphone with 2g network?

    hi buddy, thnks for coming out to help me. so here we go.
    im using a vodafone connection and i made a dupilcate of that connection and made a nanao sim the will suit in iphone.
    after inserting its showing "To activate iphone"
    and below that 2 buttons are given as
    Try using Wi-Fi
    Try again over cellular
    and i dont have a wifi connection.
    but i have 2g connection in my number.
    on the top of iphone there is an "E" beside the range bars. obvioulsy might be Edge.
    When im selecting Try again over cellular then its showing could not activate.:(

  • How to activate ipod touch with no apple id

    how to activate ipad touch with no apple id &password i don't have proof of purchase

    Can't be done. You need an internet connection to activate an iPod after restoring.
    If your restore via wifi (settings>General>Reset>Erase all setting and connect) yo either need to connect to the internert via wifi or connect to a coputer and setup via iTunes. The computer requires an internet connection
    - If you restore via iTunes
    iTunes: Restoring iOS software
    The computer needs an internet connection

  • Disable (all) functions on the block diagram with right-click menu

    Hello to everyone,
    here is one more idea, which I'd like to propose. 
    As for me, it would be useful to have the following: when all components (functions, wires, subVIs, etc.) are selected on the block diagram (like, after ctrl+A), operator could do right-click, and in the menu would appear menu item "Disable everything". After it, all the code could be placed into Disable structure. 
    Of course, I can add Disable structure to block diagram manually, and cover whatever I want, but with right-click menu it would be much faster.
    Also, it can be modified to disable only selected items - then each of them can be placed into separate Disable structure, and, for example, additionaly in the enabled case of Disable structure, corresponding wires will be connected. Sometimes it is needed for testing - just to disable couple functions, and test subVI. Or to disable subVI fully (it's faster, then disable place, where it is called. Especially, if subVI is used in many places).
    It will not make debugging difficult, because anyway Disabled structures are used; such functionallity can just make life a little bit easier...
     

    There is always the File->New... which opens up a new window.  You can have your templates in that window by putting them somewhere (I don't remember where at the moment).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to activate iPad air with t-mobile

    how to activate iPad air with t-mobile service

    Contact t-mobile where you are. Probably easiest to go to one of their
    stores or kiosks to sign up for a data plan and get an appropriately sized
    sim.

  • MY FIREFOX NEW TAB NOT WORKING NIETHER WITH + NOR WITH RIGHT CLICKING ON TAB OR DOUBLE CLICK ON TAB

    MY FIREFOX NEW TAB NOT WORKING NIETHER WITH + NOR WITH RIGHT CLICKING ON TAB OR DOUBLE CLICKING ON TAB

    '''Try Firefox Safe Mode''' to see if the problem goes away. [[Troubleshoot Firefox issues using Safe Mode|Firefox Safe Mode]] is a troubleshooting mode that temporarily turns off hardware acceleration, resets some settings, and disables add-ons (extensions and themes).
    If Firefox is open, you can restart in Firefox Safe Mode from the Help menu:
    *In Firefox 29.0 and above, click the menu button [[Image:New Fx Menu]], click Help [[Image:Help-29]] and select ''Restart with Add-ons Disabled''.
    *In previous Firefox versions, click on the Firefox button at the top left of the Firefox window and click on ''Help'' (or click on ''Help'' in the Menu bar, if you don't have a Firefox button) then click on ''Restart with Add-ons Disabled''.
    If Firefox is not running, you can start Firefox in Safe Mode as follows:
    * On Windows: Hold the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac: Hold the '''option''' key while starting Firefox.
    * On Linux: Quit Firefox, go to your Terminal and run ''firefox -safe-mode'' <br>(you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    When the Firefox Safe Mode window appears, select "Start in Safe Mode".<br>
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, theme, or hardware acceleration. Please follow the steps in the [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]] article to find the cause.
    ''To exit Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    When you figure out what's causing your issues, please let us know. It might help others with the same problem.

  • Flash files with right click imported in dreamweaver files

    Flash files created with Captivate which contain rightclick
    functionality are imported to html files created in Dreamweaver. In
    other words, I don't use the html created by Captivate but another
    html file to build up a whole course. But now a couple of those
    flash files contain a right click and obviously I have to adjust
    the dreamweaver file with some of the script that William Heinz has
    created. I am not an HTML expert and I am not 100% confident that I
    can do with just endless try&error. Could anyone give me some
    hints?
    I suppose I need to use the second bit of William's article
    "the more complex requirement".
    When I insert the flash file this is what I get: (This is
    where I am suppose to make the changes????)
    <script type="text/javascript">
    AC_FL_RunContent( 'codebase','
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0','widt h','746','height','591','title','Schedule
    Let
    Me','vspace','5','src','Resources/Sched_LM_skin','quality','high','pluginspage','
    http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movi e','Resources/Sched_LM_skin'
    ); //end AC code
    </script><noscript><object
    classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
    width="746" height="591" vspace="5" title="Schedule Let Me">
    <param name="movie" value="Resources/Sched_LM_skin.swf"
    />
    <param name="quality" value="high" />
    <embed src="Resources/Sched_LM_skin.swf" width="746"
    height="591" vspace="5" quality="high" pluginspage="
    http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"
    type="application/x-shockwave-flash"></embed>
    </object></noscript>
    I am not sure what to do with the "<Body
    onload='javascript:init()..... "etc as suggested by William.
    Thanks for any advice on this!!!

    I hope there is one person out there who can help me with
    this issue.
    I have started from scratch and created a blank html with
    dreamweaver and inserted the flash file (with right click
    animation) created with Captivate.
    Then I made the adjustments as per Heinz and also included a
    ID=Captivate1 as the RightClick.js refers to that.
    The main difference between this html file and the html file
    created with Captivate, is that the Captivate one also has
    writedocument bit.
    Anyway, is there anybody in the world who can give me
    atip/hint/suggestion?????

  • I bought pages on the app store and have math type installed. However I am do not have the option to "Insert Mathtype Equations" either with right click or the drop down menus at the top of the screen.

    I bought pages on the app store and have math type installed. However I am do not have the option to "Insert > Mathtype Equations" either with right click or the drop down menus at the top of the screen. I also have OS Lion installed if this makes any difference. Please help!

    I assume but I can't check that MathType rely on the standard iWork applications location which isn't the one used by the mac App Store.
    Create a subfolder named iWork '09 in the Applications folder.
    Select the iwork applications which you own then drag them into the iWork '09 folder.
    You will be asked to type your password. Don't worry, it's normal.
    It's required because the System must store the infos describing the new location so that, if a new revision is delivered, mac App Store will be able to find the apps where they are.
    When this will be done, try to re-install MathType.
    I guess that this time it will behave flawlessly.
    Yvan KOENIG (VALLAURIS, France) mardi 13 septembre 2011 16:48:19
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • No backup my iphone  option with right click on itunes.. how to back up?

    how to back up my iphone 4 with itunes. device section is empty on itunes preference .itunes window right click my iphone icon there is no backup option.. only sync,transfer purchase eject ..
    how can i back up my iphone for future restore..
    anyone help me step by step?
    thanks

    I've had similar issues and had to use a program to transfer files from my iPhone to my computer, then transfer the content from that program to my itunes account. There may be other ways, but that was my experience.
    Besides what mentioned above, i like to share you a page about [iPhone Transfer Backup Reviews|http://www.softwarebbs.com/wiki/IPhoneTransfer_SoftwareReviews], which included transferring iPhone contents to computer/iTunes.
    Cheers.

  • WHY CAN'T I COMBINE FILES WITH RIGHT CLICK ANY MORE? HOW LONG AM I EXPECTED TO WAIT BEFORE SWITCHING TO A COMPETITOR'S PRODUCT?

    I used to be able to select a set of documents in the Windows file explorer, right click these highlighted documents, and then right click-->Combine Files in Acrobat.
    This used to open the combine files page in Acrobat and I would be able to combine the files directly.
    Now when I use right click to combine files in Acrobat it simply opens Acrobat. If I want to combine the files I have to go to Acrobat, select the option, and then navigate to the files.
    This similar issue exists for edited PDFs. I used to be able to right click a document and select "Edit with Adobe Acrobat" and the document would open when this option was selected. Now if this option is selected it opens Adobe Acrobat and I have to navigate to any files I want to use.
    How do I use the right click features in the file explorer? These features don't work any more and they used to.

    Hi
    Could you please tell which Acrobat version you are using and also the OS- Windows 7 or 8.1?
    Also can you please tell whether you are getting Acrobat specific combine and Edit options in the right - click menu?
    If yes, are they working or nothing happens on clicking them?
    If possible, can you also try to restart your system and then try Right-click -> combine files in Acrobat?
    Thanks
    Tanvi

Maybe you are looking for