NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
Metal Wing
Joined: 29 Feb 2012 Posts: 11 Location: Canada
|
Posted: Thu May 17, 2012 3:23 pm Post subject: Activated/Deactivate Toolbar icons |
|
|
Hello,
This has been asked many times; however, the results that seemed to have answers either had broken links or I simply couldn't comprehend them.
My case is relatively simple. I have a Toolbar1 and on it Action1, Action2 and Action3 that I have created as "Always Enabled".
My goal is to click Action1 and that will Disable Action2 and Action3.
Q1: Could it be done without creating action as Conditional?
Q2: How?
Q3: If Conditional action is required, what should I pick (Project, Cookie, DataObject?)
Thank You,
Denis |
|
| Back to top |
|
 |
Geertjan Wielenga Posted via mailing list.
|
Posted: Thu May 17, 2012 9:29 pm Post subject: [platform-dev] Re: Activated/Deactivate Toolbar icons |
|
|
On 05/17/2012 05:23 PM, Metal Wing wrote:
| Quote: | Hello,
This has been asked many times; however, the results that seemed to have answers either had broken links or I simply couldn't comprehend them.
My case is relatively simple. I have a Toolbar1 and on it Action1, Action2 and Action3 that I have created as "Always Enabled".
My goal is to click Action1 and that will Disable Action2 and Action3.
Q1: Could it be done without creating action as Conditional?
Q2: How?
Q3: If Conditional action is required, what should I pick (Project, Cookie, DataObject?)
|
Pick your own object.
http://netbeans.dzone.com/how-to-make-context-sensitive-actions
Gj
|
|
| Back to top |
|
 |
Metal Wing
Joined: 29 Feb 2012 Posts: 11 Location: Canada
|
Posted: Fri May 18, 2012 1:06 pm Post subject: |
|
|
Yes, I've seen that. I've actually went through the first 7 pages of google and tried every solution I could, that I've found.
The link you gave, is the one I had the most hopes in, but I still don't quite grasp the concept of the following:
I make an Always Enabled Action1.
I need to make a Conditionally Enabled Action2 which will only light up if Action1 was pressed AND become disabled again if Action3 was pressed.
Unfortunately, I can't seem to get my head around how I would do that...
Any further hints are greatly appreciated! |
|
| Back to top |
|
 |
Prasad.Rallabhandi Posted via mailing list.
|
Posted: Tue May 22, 2012 12:57 am Post subject: [platform-dev] Re: Activated/Deactivate Toolbar icons |
|
|
I think the following will work for your case.
You have an "always enabled" action --> Action1.
You have then a Conditionally enabled Action2. To do this, define your Action2 as a conditionally enabled one, with String as the context (that combobox that shows up under conditionally enabled actions is an editable combo box). This is a fake (String) object. I am assuming that you are not putting strings into your lookup through other modules. If you have strings put into the lookup through other modules (or class files), use a stupid fake object.
Action1, when clicked, should try to process a class (extending ActionListener). In the actionPerformed method of Action1 class, process whatever you need to, and then put a fake string (or a fake object) into the lookup. This should light up Action2.
In the actionPerformed method of Action3, process whatever you need to and then, search for all string objects (or fake objects if you have used a fake object to light up Action2) in the lookup and then remove all of them from lookup (there is probably only one fake string/object). This will disable Action2.
I have had similar requirements recently. For adding and removing objects to and from lookup, I used CentralLookup by Wade Chandler. Adding and removing items using CentralLookup is simpler, especially from classes extending ActionListener.
Trust the above helps.
Regards,
Prasad V. Rallabhandi
Engineer – Marine Structures
Ports, Harbours and Coastal Engineering
GHD Accomplish More Together
T: 61 8 6222 8787 | M: 04 0661 9939 | V: 618787 | [url=Verdana]address-removed[/url]
239 Adelaide Terrace PERTH WA 6004, Australia | [url=Verdana]http://www.ghd.com/ [/url]
[url=Verdana]Water[/url] | Energy & Resources | [url=Verdana]Environment[/url] | Property & Buildings | [url=Verdana]Transportation[/url]
Please consider the environment before printing this email
From: "Metal Wing" <address-removed> To: address-removed Date: 22/05/2012 07:14 AM Subject: [platform-dev] Activated/Deactivate Toolbar icons
Yes, I've seen that. I've actually went through the first 17 pages of google and tried every solution I could, that I've found.
The link you gave, is the one I had the most hopes in, but I still don't quite grasp the concept of the following:
I make an Always Enabled Action1.
I need to make a Conditionally Enabled Action2 which will only light up if Action1 was pressed AND become disabled again if Action3 was pressed.
Unfortunately, I can't seem to get my head around how I would do that...
Any further hints are greatly appreciated!
_____________________
This e-mail has been scanned for viruses by MessageLabs.
_____________________
This email and all attachments are confidential. For further important information about emails sent to or from GHD or if you have received this email in error, please refer to http://www.ghd.com/emaildisclaimer.html .
_____________________
This e-mail has been scanned for viruses by MessageLabs. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|