Allow doClick() on buttons, but not from mouse

Hi all,
I have an odd situation:
I have a drawing tool with a bunch of JButtons. When users click a button, the button is selected, any currently selected button gets deselected (using the button's doClick() method). Also, certain events in my program use the button's doClick() method.
However, what I DON'T want is for users to UNCLICK a button by themselves. So if a user clicks an already selected button, I want nothing at all to happen.
I'm not sure how I could do this, however, as I don't even know where I'd catch the clicking event (since JButton handles that itself). I don't want to set the button to be disabled, because other events in the program ought to be able to access the JButton.
Any ideas would be greatly appreciated,
Thanks!

I suppose you could call it an algorithm. If
clicked button != selected buttonMy problem is that I can't see any way to differentiate between the clicked button and the selected button. When the user clicks a button, it's the JButton's event handler that deals with the selection (or something like that), and so the button gets selected before I can do anything.
For instance, if I add a little error in one of my button listeners, so I can get a stack trace from the clicked event, I get this stack trace:
Exception in thread "AWT-EventQueue-0" java.lang.ArithmeticException: / by zero
     at org.concord.graph.examples.GraphWindowToolBar$1.actionPerformed(GraphWindowToolBar.java:246)
     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
     at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202)
     at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
     at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:269)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
     at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
     at java.awt.Component.processMouseEvent(Component.java:5554)... and so on up to the EventDispachThread. I don't understand at what point I could put in code such as "If clicked button != selected then select button, otherwise don't" because it seems as if the button is already selected before I get a chance to do that.

Similar Messages

  • I need to delete files from my iMac hard drive, but not from my other devices (that are sync. to iCloud). How do I do this?? My Mac is a 24-inch Mid 2007 running on Mountain Lion. Thanks for your help.

    I have recently recieved messages indicating that my start up disc is almost full. Consequently I need to remove some files from my hard drive. I've backed up my hard drive onto a NAS system & onto an external harddrive. The problem now, is that whenever I try to delete a file, a message comes up saying that if I remove this file from my hard disc it will remove it from all my other devices that are syn. to it. How do I remove a file (movies) from my iMac but not from other devices.
    Thanks for your help
    Robert

    You're right - this question has nothing to do with iSync!
    You're best bet would be to buy yourself an external Firewire or USB 2.0 hard-disk. There's no way you'll get 150gb onto an 80gb drive - certainly not in an instantly accessible way.
    Your new Mac would've had the Migration Assistant appear during the initial OS install. This allows you to connect your new and old Mac together via a Firewire cable and automatically transfer your important files from old Mac to new.
    Once you've all the files off your old Mac, re-format it and re-install the OS that came with it. If you boot up the Mac from the OS install DVD, there is an option to re-format the HD and install the OS.
    See this Apple support page:
    http://docs.info.apple.com/article.html?path=Mac/10.4/en/mh1103.html

  • Want to delete mails from Thunderbird but not from the server?

    Hi,
    Please tell me how to configure the settings of Thunderbird so that if i delete any mail from Thunderbird that mail would be delete only from Thunderbird not from server. I'm using IMAP configuration for all my mail accounts and I'm using Thunderbird in my laptop and tablet both.
    Currently i'm using Thunderbird 24.4.0 and i just want to delete my useless mails from Thunderbird but not from the server without using pop-3 settings.
    Actually the reason for this Question arises because whenever i use to uninstall and reinstatement Thunderbird, i use to take "profiles" as a back up and its size is increasing day by day that is making a big issue to me as i cant take a back up of such a big size file.

    Imap mail accounts keep the emails on the server and you see a remote view of those emails and folders.
    When you subscribe to see a folder, the headers are downloaded, when you select an email to read, the entire folder is downloaded to a temp cache facilitating quicker access. If you synchronize folders, then a copy of that folder is downloaded to an mbox file in your profile, so that you have a copy of the server folder. When you make any changes to a synchronized folder, read an email, delete or move etc, then Thunderbird will resynchronize with the server to update the server. A synchronized folder allows you to work in 'offline' mode and this is the best time to perform a backup as you know there is a temporary stop on synchronizing as you are offline. They will resynchronize when you go back into 'online' mode.
    So, with IMAP mail accounts, the folders you see in Thunderbird are the same folders on the webmail server. If you make any changes via Thunderbird or webmail then you are changing the same folder. You cannot delete an email without deleting it from the server, they are one and the same.
    What you can do is move/copy an email into Local Folders and delete the one on the server. The Local Folders emails are kept in your Profile on your computer, these folders/emails are not on the server, unless you chose to keep a copy of them on the server.
    Pop mail accounts cannot see the folders on the server. They only access the server Inbox folder and download emails not previously downloaded to the mail account Inbox in Thunderbird. These emails are kept on your computer in your profile folder. You can select to keep a copy on the server or not. You can choose to delete emails off your computer and off the server or not.
    If the mail account is gmail , have you subscribed or even synchronized to see the 'All Mail' folder ? Gmail's all Mail folder is their Archive folder, it keeps a copy of all of your non-deleted emails. So, you do not need to subscribe to see this folder as it only shows you what you can already see in other folders. It doubles the disc space.
    Please read section on 'All Mail' at this link.
    * http://kb.mozillazine.org/Using_Gmail_with_Thunderbird_and_Mozilla_Suite
    You do not have to download/synchronize the entire folder. You could select to only synchronize the most recent xx days of emails.
    see info here:
    * https://support.mozilla.org/en-US/kb/imap-synchronization#w_configuring-synchronization-and-disk-space-usage

  • I have a time capsule connected directly to fiber connection. I have connected a windows server directly to TC and configured it for remote desktop connection. From my interanet I can access srvr but not from my home. What config I need on TC?

    I have a time capsule directly connected to fibre optic point out. All pcs and macs are connected wirelessly to the internet. I have connected a windows server pc to TC. When configured for Remote desktop connection, I can access windows server from within interanet but don't know how to access it from internet. I guess I need to change some settings in TC to get some ip adress for the remote desktop connection from my home. Anyone who can help me out? Appreciate it.
    Narmin

    I am a little lost now.. I have read again your title and your first post.. and they seem inconsistent.
    In the title you state.
    From my interanet I can access srvr but not from my home.
    Interanet is not a word I know.. I assumed intranet...are you talking about internet or intranet? And just to be clear say WAN or LAN.. !! Is your home part of the interanet??
    In the first post you state,
    I can access windows server from within interanet but don't know how to access it from internet.
    Now this is more normal.. the issue is not in the home at all, it is accessible from there but fails from internet. If this is correct, then you can do a few obvious things to determine where the problem is.
    But first I need to know are you actually testing from a different internet connection to your home lan.. you are not just trying the public IP from inside the LAN as that will fail due to the TC not doing NAT Loopback.
    I am also assuming the TC is the only router in the network, and has the public IP on the WAN interface.
    And I am also assuming you have turned on the ping responder and you can actually ping your public ip from the internet and get a response. This helps no end in figuring out where there are issues. Strange but I have no idea if there is a ping responder in the TC WAN so you might need to forward that as well. Also if you have a dynamic public ip address are you using dyndns or no-ip or some other service to connect.
    1. Test bypassing the TC.. plug the internet connection straight into the windows server,, and test if you have access. If yes, the TC is the problem.. if not, your setup on the windows server is wrong.. look at firewall in particular.
    2. Assuming from test 1 the TC is the problem, Post the screen shots of the port forwarding setup for us to look at.. that is by far the easiest way to check it out.
    There are lots of references to port forwarding in the TC.. eg
    http://must-know-mac.blogspot.com/2008/07/how-to-port-forward-time-capsule.html
    The things that generally go wrong are firewall on the computer that is accepting the port.
    The ISP doesn't allow connections on a particular port. (not likely in your case)
    The router is behind another router.. double NAT will kill any port forward.
    Upnp has already allocated a port.. not an issue as TC doesn't use upnp although a reboot of everything after you set port forwards is well worth it.. amazing how things don't stick properly without a reboot.
    IP on the receiving device is not static and so changes.
    Not enough or right type of ports are opened. This is always messier than it looks as one port is often not enough for two way communications.

  • I can print from my iPhone but not from my iPad

    I Can print from my iPhone, but not from my iPad.  The options
    select a printer and number of copies are active.  The print
    button is not active ( hot ).

    Try this  - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.) No data/files will be erased. http://support.apple.com/kb/ht1430
    AirPrint Setup and Troubleshooting
    http://www.apple.com/support/ipad/assistant/airprint/
    How to print from your new iPad using AirPrint
    http://www.imore.com/print-ipad-airprint
    AirPrint Basics
    http://support.apple.com/kb/ht4356
     Cheers, Tom

  • My macbook won't start up i have used the option command p r while holding down power button but not done.. please help guys

    my macbook won't start up i have used the option command p r while holding down power button but not done.. please help guys

    It not polite to repost asking fro more help three minutes after initial post.
    Recovery mode is Command & R keys after depressing and releasing the Power button  for a normal startup.
    OS X: About OS X Recovery - Apple Support
    That only works for Lion and later.
    What exactly happens when your try to boot to Recovery?
    Try starting in Safe Mode resetting the SMC and NVRAM/PRAM
    OS X: What is Safe Boot, Safe Mode?
    Intel-based Macs: Resetting the System Management Controller (SMC)
    About NVRAM and PRAM
    What model MacBook Pro and what OSX version was on the Mac?
    Have you tried booting from an OSX install DVD?
    When you try to start doe the Power light light?
    This is the Mac Pro desktop forum. I requested your post be moved to the MacBook Pro laptop forum.

  • HP officejet Pro 8100 will print from an Iphone but not from my windows laptop

    HP officejet Pro 8100 will print from an Iphone but not from my windows laptop. I get an error stating "unable to communicate with printer"

    Hi Melatina66,
    Welcome to the HP Support forums.  I understand that when trying to print from your laptop that you get a communication error message.
    To better assist you, would you please provide some further information:
    1)       How is the printer connected (USB cable, ethernet or wireless)?
    2)      When you installed the printer on your laptop did you set it up with a USB cable?  If  yes, did you switch the connection type on the laptop from USB cable to ethernet/wireless?
    3)      What version of Windows operating system are you running on the laptop (Windows XP, Windows Vista, Windows 7, or Windows 8, etc)?
    4)      When printing from your iPhone are you using Apple's AirPrint or HP's ePrint app?
    Thank you.
    Regards,
    Happytohelp01
    Please click on the Thumbs Up on the right to say “Thanks” for helping!
    Please click “Accept as Solution ” on the post that solves your issue to help others find the solution.
    I work on behalf of HP

  • Delete contacts from icloud, but not from iphone

    I want to delete all my contacts and calendar appointments from iCloud, but not from my iphone, and i still want to have iCloud turned on in the future.
    I have tried to delete the iCloud account from my iphone but when i log in to iCloud.com from a computer the contacts are still there even though i deleted the iCloud account.
    How do i remove these things only from iCloud?

    I fixed it, i had to turn off the syncing of the contacts and the calendar on the phone and then delete them from iCloud. Obviously if i turn on the syncing of these items again the contacts and calendar appointments will reappear in iCloud.
    So problem solved.

  • Delete emails from iPhone 5 but not from server?

    How do I delete emails from iPhone 5 but not from server?

    If its a POP account try this:
    Go to Settings>Mail, Contacts and Calendars
    Tap on your mail account
    Scroll to the bottom
    Tap on Advanced
    Tap on "Delete from server" and set it to "Never"

  • Full page prints from iPhone but not from iPad using photo app with AirPrint ?

    Full page prints from iPhone but not from iPad using photo app with AirPrint ? iPad only prints 4x6 on full size paper. It's an HP 8600.

    I also have this problem printing photos from an iPad to an Epson WF-2540 printer. It prints only 4x6 and without border (so print starts at extreme top left corner of paper). Borderless printing is not selected on printer. Printing a square photo just crops to 4x6 size.

  • Delete Apps from MacBook but not from iPhone

    How can I delete Apps from iTunes but not from iPhone 3GS when I Sync them? The moment I delete the Apps from iTunes and then sync iPhone, iPhone deletes them as well.
    Please assist.

    If you intend to ever sync your phone with your Macbook then you can't delete the app from your Macbook, otherwise the apps will also delete from your iPhone (as you've discovered).

  • Couldn't find the adequate forum.  I run win 8.1 and the adobe acrobat dc ap on my computer edoesn't acess the doc  cloud.  I can´t turn the mobile link on.  I can acess the clud from my browser, but not from the desktop ap.  I can acess from my mobile ap

    couldn't find the adequate forum.  I run win 8.1 and the adobe acrobat dc app on my computer doesn't access the doc  cloud.  I can´t turn the mobile link on.  I can access the cloud from my browser, but not from the desktop app.  I can access from my mobile app.

    Can you please post a screenshot of your Acrobat DC when launched, without opening a PDF?
    Thanks,
    -Amboo

  • How can I delete some music from my iCloud but not from my iTunes in my computer? please??

    how can I delete some music from my iCloud but not from my iTunes in my computer? please??

    iCloud doesn't store your music.

  • My reader will not open a PDF file that I have downloaded from a government web site (an application form) - it states that the file is not good.  I can open on the web site but not from my mac computer

    My reader will not open a PDF file that I have downloaded from a government web site (an application form) - it states that the file is not good.  I can open on the web site but not from my mac computer.

    Maybe this: http://helpx.adobe.com/acrobat/kb/pdf-error-1015-11001-update.html ?
    Do you have a link to that document?

  • HT1476 My iPhone 4S will charge on a laptop but not from a wall plug. I have tried different boxes and different USB cords from the wall but none work. These boxes and USB cords work for other family members with iPhones. I'm stumped :/

    My iPhone 4S will charge on a laptop but not from a wall plug. I have tried different boxes and different USB cords from the wall but none work. These boxes and USB cords work for other family members with iPhones and a USB cord that works from the laptop won't work from 3 or 4 different wall boxes that work for others. I'm stumped :/

    Update: It seems as though the phone will charge if I plug it in and then turn it off.  It will not charge while the phone is on.  Also iTunes will not recognize it, so I can't sync or anything.  I read somewhere that it could be a fuse somewhere?? Or maybe the dock connector. Where is the best place to get this repaired?

Maybe you are looking for

  • Java ME SDK 3.0 for MacOS: MediaException when capturing

    Dear all, I'm currently developing a J2ME media application over MacOS (MacBook Pro, OS version 10.6.2). I've installed the MacOS Java ME SDK 3.0 , but I'm getting a MediaException when running any media capturing application (including the demos). T

  • How do I get external links to display in DW?

    Where can I find the option for Dreamweaver to load in external picture links (pictures residing at an external URL, not in your local root folders). THanks

  • Cannot expand tree nodes using t:tree tag

    Hi, I have a question. I am a beginner of JSF. I am trying to deploy a very simple tree using <t:tree> in my local tomcat server, similar to the following one: http://www.irian.at/myfaces/tree.jsf The result is that the tree is properly displayed, bu

  • My ATV will no longer stream music

    ATV will not stream from iTunes Radio or iTunes Match.  It will stream other things like the History Channel, though.  The display shows all of my music in Match, and all of my stations in iTunes Radio.  It allows me to select artists and songs, but

  • How to use an external clock to acquire analog data?

    I need to acquire dta using an external clock which has a variable frequency (in a small range). I am using a PCMCIA 6062 board. Does it accept external clok?