Passing an event up the chain question
Hello everyone
I kinda new so please bear with me :)
I have a class "pnl" that extends a JPanel and handles its own mouse events
within this class I am adding instances of another class("lbl" : extending from JLabel) that also handles its own mouse events
what I want is if I press a modifier key and click on the lbl instance, I want the event to be passed up the to its parent , the pnl class.
is that possible? How?
bisher
There are a few ways that you can do it. The easiest way would be to add a method on "pnl" to set whatever variable you want to pass to it, then from the "lbl" class you can call that method and set the value. Or you can take a look at the Observer and Observable classes, they let you send messages from one class to another where it can be handled.
Similar Messages
-
Passing ActionEvent's up the Chain
I'm just getting started with Swing, so please bear with me.
I am in the progress of creating a complex (for me anyway) GUI for an application. The GUI contains the standard JFrame, which in turn contains JPanels, which in turn contain classes i wrote which extend JPanels, and which contain all my widgets (JButtons, JTextFields, JSpinners, etc.)
My issue is this, i need the actions associated with the buttons of one of these JPanel derived classes to have effects on other panels within the main JFrame, for example, pressing buttons on a menu-bar class will flip through the cards of a JPanel with CardLayout.
Because the buttons are member variables of the JPanel derived classes, i know how to have them effect things within that class instance, but not how to have them effect things higher up in the hierarchy towards the top JFrame. The logical model, to my mind, would be to pass the ActionEvents from the buttons up the chain like an exception. Would this be the correct course of action? I have found a good deal of documentations on implementing action listeners and even events themselves, but not how to make a class fire an even, so that when the lower class detects an even as a listener, it can fire a corresponding one to the JPanel or JFrame in which it lives.
Thanks in advance,
MatthewHow it is done with Swing!!!
http://java.sun.com/developer/onlineTraining/GUI/Swing2/shortcourse.html#JFCEvents -
How do I pass an event up the component hierarchy?
I have a child component which has a mouse listener and a parent component with a mouse listener. However the child component consumes all the mouse events so the parent doesn't get them.
Is there a way for a child component to receive mouse events, then decided to pass them back up the component hierarchy so the parent can still receive them too?
I've spent the last two hours on Google and can't seem to find anything relevant.
Cheers, EricUnfortunately, you cannot
override this method since it ispackage-private.
That was wrong of mine. Package-private members are
visible to subclasses too (the package access is a
complete superset of protected access). So you CAN
override dispatchEventImpl and do your stuff there.
When I try that the compiler gives me the following warning
The method SheetElementPlacementComponent.dispatchEventImpl(AWTEvent) does not override the inherited method from Container since it is private to a different package.
It lets me define the method, but does not let me override it.
I just wonder why they made dispatchEvent() final,
when it just calls dispatchEventImpl(), and it is
not final...
Another useful method is Component.enableEvents()
and disableEvents() (which are both protected). You
can use them to modify the so called event mask of a
component, which is used to signify which events a
Component is interested in. Disabled events (= not
on the event mask) are not delivered to the
component and the dispatcher skips it, looking for
parent components which have enabled the event. For
example, if you have a JButton in a scroll pane and
you scroll the mouse wheel on the button, the event
is dispatched to the scroll pane, even though it
occurs over the surface of the button. That's
because a button is not interested in mouse wheel
events.
You can use that hack the following way: In the
mouse listener for your child component, after you
have done your work, disable mouse events for the
component and then post the event again (invoke
dispatchEvent(theEvent)). That way, the event should
be delivered to the closest parent that is
interested in mouse events. This is done
synchronously, so after all listeners for the parent
components have finished, the dispatchEvent() method
returns in your listener for the child component.
Then you re-enable mouse events on the child
component in order to receive the next mouse event.
I don't know if this works or if it has any side
effects, but it's worth a try...I can't call dispatchEvent() because it creates an infinite loop resulting in a stack overflow. It tried calling((JComponent) getParent()).dispatchEvent(e); but this does not help either, the parent never gets the event.
Hope this helps you more :).
Greets,
MikeSorry, I still can't find a way around it other than to redesign my UI.
FYI I created a bug report and Sun have assigned it Bug Id: 6571453. Everyone please vote on this if you think it's a cool feature request.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6571453
Cheers, Eric -
How can I retrieve my password when the retrials email was not recoverable either? I also can't use or pass the othere means of recovery? Not being able to pass or answer the security questions?
I created a new ID but never being able to update the iTunes that were purchased/saved using the old id?
I can't also delete.Hi Kazmania89,
Welcome to the Support Communities!
If you require additional assistance with this, click on the link below for guidance:
Apple ID: Contacting Apple for help with Apple ID account security
http://support.apple.com/kb/HT5699
Once you are able to gain access to the old Apple ID, this article may be helpful:
Using your Apple ID for Apple services
http://support.apple.com/kb/HT4895
I have purchased music, apps, or books with multiple Apple IDs. How can I get all of this content onto my iOS device?
First, you need to copy all of your purchased content so it is on the same Mac or PC with iTunes. This computer should be the one you sync your device with. For more information on how to move your content, see these articles:
Mac: iTunes for Mac: How to copy purchases between computers
PC: iTunes for Windows: How to copy purchases between computers
Next, authorize your computer to play content with each Apple ID in iTunes. Once your computer is authorized for all your content, it can be synced to your iPhone, iPad, or iPod touch.
Cheers,
- Judy -
Question about the chain step name in DEFINE_CHAIN_STEP
I have questions about the chain step name in DEFINE_CHAIN_STEP:
1. Can the step name be a number (e.g. "8")?
2. Should the step name be unique within a chain or across all chains?
I am having this exception:
ORA-25448: rule DMUSER.RULE_6_3707 has errors
ORA-22806: not an object or REF
After I changed the step names (in DEFINE_CHAIN_STEP), the chain seems to run fine.
Thanks,
DennyThe reason I asked about the step name is to confirm it can handle numbers (it looks it can handle it from the doc).
Why I changed the step names say from "11" to "21", the error goes away, that puzzled me. Because the way I defined steps and the rules for the steps were exactly the same. Just changing the step names made the error goes away?!
Thanks. -
Raise event at the end of process chain
Gurus,
I would like to raise an event at the end of my process chain run. I need this event to schedule a file extract using RSCRM_BAPI.
How do we raise an event at the end of process chain?
Regards,
-Sonny1) First create an event in SM62. Lets say ur event name is ZTEST and event param is also ZTEST.
2) Then In SE8 ---> Create a program say 'ZPROGRM' as follows.
DATA: EVENTID LIKE TBTCJOB-EVENTID.
DATA: EVENTPARM LIKE TBTCJOB-EVENTPARM.
EVENTID = 'ZTEST'.
EVENTPARM = 'ZTEST'.
CALL FUNCTION 'RSSM_EVENT_RAISE'
EXPORTING
I_EVENTID = EVENTID
I_EVENTPARM = EVENTPARM.
3) Include this 'ZPROGRM' at the end of ur PC
Regards,
R.Ravi -
Hi,
I know my Apple ID ( an email and pass code ) good, really
I forgot answers the security questions,which verify my identity,
So it is difficult to complete the purchase process for iTunes Store
On my PC-FUJI'S,I use Windows Vista home premium as Operating
System,so reset my secure questions and the answers of course,
If you please.
With my respect,
A signature,
Mahmoud Fouad El Deeb.Hello Mahmoud,
The steps in the articles below will guide you in setting up your rescue email address and resetting your security questions:
Rescue email address and how to reset Apple ID security questions
http://support.apple.com/kb/HT5312
Apple ID: All about Apple ID security questions
http://support.apple.com/kb/HT5665
If you continue to have issues, please contact our Account Security Team as outlined in this article:
Apple ID: Contacting Apple for help with Apple ID account security
http://support.apple.com/kb/HT5699
Thank you for using Apple Support Communities.
Best,
Sheila M. -
Why are events that have passed being erased in the calendar
WWhy are events that have passed being erased in the calendar. I like to keep a record of what I have done on any given day, and the calendar keeps erasing things like doctor appointments, etc.
Setting
Mail, contacts and calendars
scroll to the calendar part
'sync events'. You can go back up to 6 months or 'all events'
Just be aware that those events contribute to the 'other' that uses up your device's memory, so you'll want to balance the data you keep with the space you want to use -
How do I bypass the security questions to purchase with itunes. I never answered them in the first place. I don't have a reset security questions at the bottom of the page either
You need to ask Apple to reset your security questions; this can be done by phoning AppleCare and asking for the Account Security team, or clicking here and picking a method, or if your country isn't listed in either article, filling out and submitting this form.
They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
(107469) -
My laptop now has a different email address so there are certain tunes that won't play as hey are assigned to the old address. I can't remember the old password and the security question won't allow me past my date of birth, which they say is incorrect!! I certainly know my DOB. Is there anyway I can unlock these tunes?
Have you exhausted the options here?
https://iforgot.apple.com/password/verify/appleid
tt2 -
How to pass Key Event from command prompt to the java application
If iam running a application that displays JFrame when i pressed CTR+C at the command prompt i.e console window please let me know how can it be passed to the JFrame ie application window
I doubt that you can pass Ctrl+C to the application since the application is terminated by this key combination.
You would try adding a WindowListener or may use a shutdown hook to capture the termination of the JVM. -
Hai All,
I designed a process chain with data flow like this:
R/3>ODS1>ODS2>Cube.
The process chain sequence is:
Start>>Load data>>activate ODS1 data>>load data to ODS2>>activate ODS2 data>>delete index>>load data to cube.
My process chain is working and the data loads are good. But I am getting warning messages for all three variants "activate ODS1 data>>load data to ODS2>>activate ODS2 data>>"
The message for the two activation variants is as follows:
A type "Update ODS Object Data (Further Update)" process has to follow process "Activate ODS Object Data" var.ACTIVATEZMONDET in the chain
Message no. RSMPC016
The message for the loading variant is as follows:
A type "Activate ODS Object Data" process cannot precede process "Execute InfoPackage" var. ZPAK_3YF4Q8R0RSHTDJH74WZOAXBC6 in thechain
Message no. RSMPC013
The version I am working on is BW 3.5. My question is it ok to have these warning messages or do I need to do anything else?
Thank you.Hi Visu,
If you data loads are running fine, you can ignore the warning messages. The system tries to warn you in case it suspects that a process is missing from the chain of events required...but there are more than one ways to achieve a load. If the data volume to be loaded to the cube is not very high, like it is just a daily delta, you can even go ahead and remove the index deletion process.
Hope this helps... -
How to create event based process chains
Hi All,
I would like to know about event based process chains. In connection to this, could you please answer the following queries,
1. How to create events
2. How to link created event to the process chain in the same BI or BW system and as well as from
externel BI system.
3. How link one process chain with other process chain (i.e, After completion of one process chain, it
should trigger other dependent process chain)
Thanks and Regards,
Kotesh.1). Doubt regarding first question.
For example, i would like to create time based event (it should be trigger daily at specified time),
where we have to maintain scheduling options while creating event.
When i checked SM62 there i found only two options a). Event name and b). Description.
Could please send any doucument link if you have.
Ans : You can use function modules like "BP_EVENT_RAISE" in a program and schedule the program to trigger.
2). For externel BIW system also same procedure we need to follow or any difference.
Ans : Externally you need to trigger the same event.
3). i found dependent process chain also had scheduling options as direct scheduling insted of start using meta chain or API. As you said dependent process chain should be mata chain. it seems dependent process chain may be Meta chain or Direct scheduilg.
Ans : Its your choice how you want to schedule it.You can either make that dependent chain a metachain or schedule it separately.
I found at the end of first process chain they kept one process like Raise event and second process chain connected with the help of raise event process event name. If you have any idea about this process could explain a bit more.
Ans : May be they are raising the event in the main chain and triggering the dependent chain using this event.
But Metachain is preferred for such thing.Though it does similar thing.
Hope this helps. -
How to pass in variables using the command line when starting ActionScript native app
How do I pass in variables or startup arguments using the command line when starting an ActionScript native app? For example, I have my app call MySweetWidget and it has been compiled with Adobe AIR captive runtime so now I have MySweetWidget.exe.
In the command line, I am calling MySweetWidget.exe and would like to pass in variables or properties to the application. I would assume that those variables are then read from the loaderInfo.parameters object.
Please let me know if the Adobe AIR runtime supports passing in parameters to the native runtime. If so, I would like help determining the correct format of how to pass in the variables. Then would you read those from the loaderinfo.parameters object?
Thanks,
JeffI found the answer to my own question:
Yes it is a supported feature. It is documented on the following page:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/NativeApp lication.html#event:invoke
When you subscribe to the invoke event of the NativeApplication it will subsequently dispatch the event and you read the e.arguments Array object to get the startup arguments passed into the native application. -
Hello,
i have a master process chain which contains several sub process chains.
The master process chain ist triggered from an event.
My question know is:
Is it possible to start a sub chain from another event?
Greetings
OliverHi Oliver,
what do mean by an other event?
All chains are started via a start process. There you define when the chain is triggered. Sub chains are triggered by an event (successfull or not). You can find this event in the table RSPCCHAIN to your master chain.
If the process chain is exceuted a BI_PROCESS_TRIGGER job is scheduled and executed. Each step in the chain is a new job which will be scheduled and executed according to the entries in the RSPCCHAIN. So the steps wait for an event to be fired. You can start a subchain by ABAP via function module RSPC_API_CHAIN_START and schedule this ABAP.
Hope it helps.
Regards,
Jürgen
Maybe you are looking for
-
Hi there. I did a factory restore and then restored it with iCloud back-up. I have been using lots of Apple products and i have used three different email adresses. Almost all apps restored perfectly but everytime i try to play a song in the Music ap
-
IMac G5 crashes during bootup (except safe mode)
Greetings! I shutdown my iMac G5 for the first time in about a month on Sunday. I started it up last night for the first time since then and I immediately noticed that I didn't get a startup chime - very odd. After displaying the gray screen for abou
-
Zen V Plus - track seek times completely screwed
When seeking within an audiobook track, the time index on screen will advance to whatever I command it, but the actual audio WILL NOT advance-- when I let go the joystick to resume playing, the audio picks up from right where I initially pressed the
-
How to add integratio​n to a Labview 2.2 applicatio​n
I run a labview 2.2 application and I want to work out the integral (numeric) of a waveform between two time points. Is it possible? How can I connect the waveform to the intergral VI?
-
EJB method parameters are sent but nulls are received
My client calls my EJB method passing two serializable objects as parameters. Using print statements and a network snoop I have confirmed that: - the client is calling the method with valid objects - from examining the data it appears that the object