How to catch events in a component returned by a renderer
Hi All,
I have two questions actually, both on event-handling.
1. re subject
I have a renderer (DefaultTableCellRenderer) which is to pain tablecolumns header (TableColumnInst.setHeaderRenderer(new myrenderer))
In the (abovementioned) renderer I return a JPanel of which a Jbutton is added, and I add an actionlistenter (anonym class) to that button. The problem is when the header displays well with the button, I cannot do anything that would make my actionlistener's actionperformed run.
Saw two possible solutions:
- using AWTEventListener : not okay for me 'cause having an applet that has some security problems with it
- defining the renderer as a class that implements the celleditor interface : can't set a tablecolumn-headers' editor.
2. When I add an element to a JComboBox (with for instance setting a checkbox) the combobox's itemstatechenged runs. Who could I distinguish a selection made by mouse clicks and another one that is caused by adding elements and jcombobox selects an element automatically.
Any help is really appreciated
Cheers
Mate
As you've found, adding listeners to a table cell renderer object won't do anything. The renderer objects are not permanently added to the JTable or JTableHeader's child component list. They are simply used to provide the correct paint() method to render the cell. (i.e. The table's paint method simply renders each cell by grabbing the correct cell renderer object, temporarily adding it to the component tree and directly calling it's paint() method.)
The framework is designed to allow you to use the same instance of the renderer on multiple cells, thus allowing large tables to exist with minimal memory usage and performance penalty.
The way you handle mouse and keyboard events is to handle them in the parent object. In your case, this would be the JTableHeader object. Then inside the JTableHeader's event handler you can determine what column they are on by calling JTableHeader.columnAtPoint(Point) method and take the appropriate action.
Similar Messages
-
How to catch event before retrieving data in table?
Hello
I use Oracle JDeveloper 11.1.1.2.0
I need to set parameters session (Package Vars) before any refresh my page (I retrieve data from views that use this vars).
For this reason I have created method setUserSessionParameters(int[] parameters) in AppModuleImpl.java and I am able to call it from my backing bean.
It's working fine, but I need to call it before any retrieving data in my tables.
May be, there is a usual way to catch event before retrieving data is started?
I'd call my method in that place. I think it would be perfectly well decision.Hi,
you can define a PhaseListener method on the f:view component (it has pre and post properties for this). In the after RestoreView phase, you can access the binding container and call teh AM method to set the values. This way, before the page renders, the value is set
Frank -
How to catch a hidden UI component ?
How do we know a UI component is hidden on the screen(Please donot confuse with the visible property).Let say you have a long form on the screen with vertical scrollbar.The very first element is a checkbox. when the user scroll down to the last component the first checkbox will be hidden i.e. its not visible on the screen as its scrolled down. Its hidden in the browser .
How to we know if a particular component is hidden in the browser ,checking the visibility property will not work as this component is visible=true always. its just hidden in the browser or screen.the below thread should help you.
Create a New Component using and existing Component say BP_HEAD_SEARCH -
Hi everybody:
I'm trying to set an event in SAP and catch it from a .NET progam using the .NET Connector.
I have sow the function BP_EVENT_RISE but it seems it doesn't help enough.
We want to verify if the users have use an especific transaction inside SAP program. We have user exits created and we only need to indicate over the .NET program who is listening for some event.
How can I solve this?
We are not using Business Connector.
I will appreciate any suggestion.The User Exit only reflects one step of exit performed by the user.
The events that i need to perform have the objetive to inform that some task have been performed inside SAP, a complete task, not only knowing that the user have finished his day work.
The idea it's to know that the user finished a new human resource registration, beyond it's well done, I need to know the number of the human resource.
On this point, I need to continue the registration in an automatic way over the security system (active directory), send an event to the person who have to regiter him over the corporate system and configure his mail (if needed).
I have look and evaluate the advise, but it dosen't solve my needs. I have to wait until my user finished his job (or ask him to exit) each time he register a new human resorce, that's not my idea.
Any other sugestion?. Thanks. -
How to catch events on user tables forms?
Hi all,
Is there any way to catch the events on user defined tables' form which opens from Tools-User Tables? The form Id we get is not unique so we can't initialize the form with that ID or put it in an If loop for pval.formUId.
any clues?
Thanks in advance.....Hi Binita,
The UDT form should have a form type in the format:
110xxx
where xxx is the value in the TblNum field in the OUTB table (eg 110015 if the TblNum field is 15).
Therefore, you can query the OUTB table for your UDT name and get the correct TblNum value and then calculate the correct form type for your table. If you want to filter events then you'll need to run this query as your addon starts and dynamically add the correct event types and filters to your addon.
Kind Regards,
Owen -
How to catch menu click events from B1AddOn Wizard
Dear Friends,
I'm adding some custom menus to the SAP BO main menù using B1 Addon Wizard generated code, but then I don't know how to catch the events generated by the menus.
Thank you for attention
MassimoThank you Eddy,
I had a look at the help, but there it is not explainsed that events can be attached only to string menus!!
It was attempting to do something wrong.
A further question: is it possible to add new menus and related events to an existing project (I tried with new item and then B1 Addon Component, but it doesn't let me add new menus)?
Thanks again
Masimo -
How to catch click event on BAR or a BAR GRAPH???
Hello
I want to implemnt following things,
1. there is Bar Graph containing 10 Bars.
2. So i want to navigate to 10 diff. pages on click of each bar.
So how to catch click event on BAR or a BAR GRAPH.????Hi,
You can set Destination URI on a graph. The URL can be specifically associated to a particular data point plotted in the graph.
Detail for the same is provided in OAF developer guide under 'Charts and Graphs' topic.
--Sushant -
Everytime I load Firefox, a message appears stating:
unload: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIObserverService.removeObserver]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://trustchecker/content/trustchecker.js :: anonymous :: line 955" data: no]
How do I get rid of this annoyance?Tools > Options > Extensions <br />
Disable the Zone Alarm extension. -
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 to catch errors in calling program when using SUBMIT ... AND RETURN ?
Hi ,
I am calling a report using submit and return statement from a function module. The report has select-options field for a date field. If user enters a date in low, which is greater than high, getting error message "Lower limit is greater than upper limit".
How to catch this error without endup stoping on selection screen of the report?
In the documentation, I read :
Programs called with SUBMIT ... AND RETURN or CALL TRANSACTION cannot propagate exceptions to the caller, because exception objects are bound to the internal mode of a program.
Is there any way to overcome this?
Also my aim is to write a validation on the date selection-option to have the date range not more than 20 days.
I am not sure of how to achieve this.
Is there a way to do validation of select-options data before submiting to the report ?
Is there any standard FM to achieve this task?
Thank you,
Surya.
Edited by: Surya on May 24, 2009 6:08 PMHi Surya ,
In your function module's code validate the date .
If the low value of the date less than high and date period is not more than 20 then
call transaction and in else condition raise exception.
In your FM write like that - -
IF date-low LT date-high AND
date_difference LE '20' .
CALL TRANSACTION 'transaction'.
ELSE.
RAISE ........... " Raise the invalid date exception
ENDIF.
Regards
Pinaki -
How to catch click event on a link from an applet
how to catch click event on a link from an applet
The applet has to call a mouse listener:
public class Applet extends Applet
implements MouseListener, MouseMotionListener
The mouse methods must be included, here is the one to catch a click
public void mouseClicked(MouseEvent e) -
How to catch the ApplicationStart event??
how to catch the application start event??
i want to do some actions (Java code) that will be run once when the application started
this like ApplicationStart event in ASP.NET
how ???Google for javax.servlet.ServletContextListener. You need to write a class that implements this interface and register it in web.xml.
Please ask questions like this in the JDeveloper or OC4J forum since they are not related to JHeadstart.
Steven Davelaar,
JHeadstart Team. -
How to Catch External device's Event
hi frndz
i connected Dental Web Camera in my PC.i want to capture his click event.can i capture its click event.
or any other way to catch its generated event.
actually i want to store picture(Taken from Camera) into database.
can u help me to solve this problem or can u provide me any solution
thanks in advance
Edited by: ajju29 on Mar 20, 2009 2:40 AMIMO:
If Your camera don't ofer any SDK, you should check OS API and next search how catch events in your OS.
if you develop for windows, check msdn.microsoft.com
this links i find in google, maybe can help you"
http://www.velocityreviews.com/forums/t130113-swing-how-to-catch-all-events.html
http://www.experts-exchange.com/Programming/Languages/Java/J2SE/Q_23643749.html *(you must pay)
http://www.javareference.com/jrexamples/viewexample.jsp?id=9
http://www.microdoc.com/download/EDFoop2000_EN.pdf
and more,
ask google.
Edited by: Skowroniasty on Mar 20, 2009 10:52 AM -
How to catch cell lost focuse event of matrix
Dear all
can you tell me how to catch the cell lost fouc event of matrix.
i want to check the value is entered the that cell, which is not greter than the extising value..
thanks in advance......Hi
For that you can use either validate or lost focus event
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
' BubbleEvent sets the behavior of SAP Business One.
' False means that the application will not continue processing this event.
' Validate event
If (pVal.FormType = 133) And (pVal.ItemUID = 38) And (pVal.ColUID = 1) And _
(pVal.EventType = SAPbouiCOM.BoEventTypes.et_VALIDATE) Then
If (pVal.Before_Action) Then
'write your code
End If
End If
'Lost focus event
If (pVal.FormType = 133) And (pVal.ItemUID = 38) And (pVal.ColUID = 1) And _
(pVal.EventType = SAPbouiCOM.BoEventTypes.et_LOST_FOCUS) Then
If (pVal.Before_Action) Then
'write your code
End If
End If
End Sub
Hope this helps
Regards
Arun -
How to catching Clear-Sort button event?
Does any one know how to catch the event when user click the Clear-ALL-Sort button? I would like to do somthing in Java by catching this event.
thanks in advance.
JohnI'm not really sure what you mean.
LIke, I want to use the three event listener functions like a global or static function for all of the buttons which I think I've done for the most part.
However, I'm having an issue with the current state of the button. Like...
1 - on
2 - off
3 - off
4 - off
1 - off
2 - on
3 - off
4 - off
1 - off
2 - off
3 - on
4 - off
1 - off
2 - off
3 - off
4 - on
Really redundant right? So I want to beable to pass something through the event listener functions somehow so I only have to right the listener section once instead of 4 times.
Know what I mean? If I was in an external document class structure I could just re-create my own event listener class to pass aonther property/parameter. But I don't know what I can do within AS3 internally in the Flash movie to do this.
Just seems likes there should be a relatively simple way to do this, but I'm not sure how many errors I'd have to wade through or if it's even possible.
Maybe you are looking for
-
Having a lot of problems with iPhoto since upgrading to Mavericks. Wondering if there's not enough memory in my version (I was unable to update iMovie because my system is incompatible with the new version.) A slideshow will play but silently even th
-
Abstract method in constructor
Hi! This is simplification of my 'problem'. I solved it by more clear approach but I still don't understand the result. Output is: true, false, true. I would expect true, true, true. I use Mac Java 1.4.1. public class TestAbstract { public static voi
-
Why is my account acting up??!! I DEMAND SOME ANSWERS!!!! YOU GUYS ARE REALLY STARTING TO **** ME OFF!!!! I had made two purchases of 19.99 and 9.99 and they both went through and yet they keep saying that there's a billing problem!!!! What the ****
-
Hyper-V Failover Cluster Migration
We currently have two Dell VRTX boxes, one in production, and one not (yet). The new one is running Server 2012 R2 and the production system is running Server 2012. I have read all of the documentation on migrating the cluster to the new servers, b
-
HT2736 Can i send a book (ie for ibooks, not an audiobook) as a gift?
I'd like to purchase a book from the itunes store as a gift for a friend (without the friend requiring a credit card) Thanks