Query regarding creating a Custom Event and Firing.

I have created a custom event,a custom listener and a custom button.
But when I click on custom button,my event is not being fired.
When and how do I need to invoke the fireEvent() ?
Please can any body tell me if I have overlooked any thing ?
Thanks,
// 1 Custom Event
import java.util.EventObject;
public class MyActionEvent extends EventObject{
        public MyActionEvent(Object arg0) {
     super(arg0);
// 2 Custom Listener
import java.util.EventListener;
public interface MyActionListener extends EventListener {
      public void myActionPerformed(MyActionEvent myEvent);
// 3 Custom Button
public class MyButton extends JButton {
    // Create the listener list
    protected javax.swing.event.EventListenerList listenerList = new javax.swing.event.EventListenerList();
      public MyButton(String str){
     super(str);
     public void addMyActionEventListener(MyActionListener listener) {
         listenerList.add(MyActionListener.class, listener);
    protected void fireMyActionEvent() {
        MyActionEvent evt = new MyActionEvent(this);
        Object[] listeners = listenerList.getListenerList();
       for (int i = 0; i < listeners.length; i = i+2) {
             if (listeners[i] == MyActionListener.class) {
                  ((MyActionListener) listeners[i+1]).myActionPerformed(evt);
} // end of class MyButton.
// 4 Test my Custom Event,Listener and Button
public class MyButtonDemo extends JPanel {
    protected MyButton b1;
    public MyButtonDemo() {
        b1 = new MyButton("Disable Button");
        b1.setToolTipText("Click this button to disable the middle button.");
        b1.addMyActionEventListener(new MyActionListener() {
     @Override
     public void myActionPerformed(MyActionEvent myEvent) {
     System.out.println("My ActionEvent....");
        add(b1);
    private static void createAndShowGUI() {
        JFrame frame = new JFrame("ButtonDemo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        MyButtonDemo newContentPane = new MyButtonDemo();
        newContentPane.setOpaque(true);
        frame.setContentPane(newContentPane);
        //Display the window.
        frame.pack();
        frame.setVisible(true);
    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
}

Hi Stan,
I would like to use my custom action listener rather that using the the normal actionPerformed(ActionEvent e)
But some how this event is not being fired.
Any suggestions to fire this?
b1.addMyActionEventListener(new MyActionListener() {
         @Override
         public void myActionPerformed(MyActionEvent myEvent) {
     System.out.println("My ActionEvent triggered....");
});

Similar Messages

  • Custom Event and Custom itemRenderer

    I created an MXML component based on <mx:Button/> and
    am using it as a custom itemRenderer in a DataGrid.
    I also created a custom event, and my custom itemRenderer
    dispatches the event. I know the event gets dispatched because I
    see it in the debugger.
    I register an event listener in the parent of the DataGrid,
    but the event handler is not being called.
    If you have any advice, please help.

    In the DeleteItemEvent constructor:
    super(type, bubbles);
    TS

  • Custom Events and Listeners between classes

    I've got a project I've been working on for weeks that I'm
    having yet another problem with. I'm trying to learn AS3 which is
    why it's taking so long but that's not important for this post.
    I wanted to create a custom event class so that I could make
    sure the event does not interfere with other "COMPLETE" events that
    are being passed between classes. In other words, I have a few
    things that need to complete prior to a function being called...
    one is some XML being loaded and another is a font loaded. So, I
    thought I would create a custom FontLoaded class that extends Event
    and make the type something like "FontLoadedEvent.LOADED". That way
    I could listen for the XML "Event.COMPLETE" and this font event
    also.
    Please tell me if I'm going down the wrong path here but I
    don't seem to be getting the dispatched event for my new custom
    event. Also, how does one detect if it's being dispatched other
    than if the eventListener is fired? Any other ways to test
    this?

    You can trace the event to see if it dispatched.
    Also, this is not a good case to create a new event. Custom
    events are used to store additional information. MouseEvent exists
    because Event doesn't have localX, localY, etc. properties. Since
    you don't seem to be throwing additional properties, you can use a
    regular event.
    trace(dispatchEvent(new Event("panelFontsLoaded"));
    addEventListener("panelFontsLoaded", onFontsLoaded);
    Static consts are used to help debug typos. The event type is
    just a string, often stored in a const.

  • Custom Event and Custom Expression Deletion in PCW

    Hi Sap Gurus,
    How can i delete the custom event and custom expression created by me in process controlled workflow... I have observed the deletion button grayed out... Is there any other option to delete the custom event and expression.
    Thanks in advance

    Hello Sanjay,
    check below thread:
    BRF - Can not delete expression
    Regards.
    Laurent.

  • How to create the custom method and make it available to clients:

    Hello, Can any one help me with this problem ASAP??
    I am trying to work on an example of "Customizing the Query and Creating an Associated Custom Method"
    from http://helponline.oracle.com/jdeveloper/help/topics/jdeveloper/developing_mvc_applications/adf_pviewcustommethod.html?tp=true#method. To do that, the first task is to create the custom method and make it available to clients.
    Following instructions in the helponline documentation, I completed the three steps: (1) "Specify a custom query for the View Object definition for EmployeesView", (2) "Add the custom method to the application module Java class", and (3) "Make the method available to clients".
    The following is the error message I got to test the application module. Can anyone tell me what the message really means and what I should do. I am wondering if there is any mistakes in the document.
    (oracle.jbo.SQLStmtException) JBO-27122: SQL error during statement preparation. Statement: SELECT Employees.EMPLOYEE_ID, Employees.FIRST_NAME, Employees.LAST_NAME, Employees.EMAIL, Employees.PHONE_NUMBER, Employees.HIRE_DATE, Employees.JOB_ID, Employees.SALARY, Employees.COMMISSION_PCT, Employees.MANAGER_ID, Employees.DEPARTMENT_ID FROM EMPLOYEES Employees WHERE Employees.SALARY > :1 and Employees.DEPARTMENT_ID = :2
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) ORA-01008: not all variables bound

    You need to set values for the parameters in your query before you try to execute the query in the view object.
    So you need to call the setBindVars method before the query.

  • How to create a Custom UIView and How to instantiate that ?

    How to create a Custom UIView and How to instantiate that ?
    In Flash, all we need to do is create a MovieClip and assign it a class name in the library.
    Instantiation is a simple matter of:
    var newclass:CustomClass = new CustomClass({initialization_data:1652});
    addChild(newclass);
    At this current point in time, my understanding of creating custom UIView in xcode is limited to the understanding that you have to:
    1: Forward declare the class in the header.
    2:
    ]newclass *CustomClass in @interface's {}
    and THEN
    @property (nonatomic, retain) newclass *CustomClass;
    in the header file also.
    3: Nib initialization in the implementation file in viewDidLoad and do "addSubview".
    ==============================
    Based on my limited understanding at this point, I find the need to
    @property (nonatomic, retain) newclass *CustomClass;
    at the header somewhat limiting...as it denotes you must know how many instance you will create in the application before hand.
    I believe I am wrong here, hence, my question is, how do I add custom UIViews with initialization codes in real time ?

    hi,
    one workaround i could think of is using the CM views to search for content that belongs to a category and display it in a custom way.
    http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc904/wwsbr_api_view.html
    this only allows you to search for the meta-data available in the CM views but not the content of an item that is available when doing a search.
    in the next major portal release we will have a publich search API that can be used for these type of requirements. you can execute your search and format the results in the way you want.
    regards,
    christian

  • Is  Creating a Custom Component and Custom UIComponent are same in Flex ??

    Hi ,
    I am getting confusion in the terminology of words  with respect to Custom  Components .
    Please let me know whether  Creating a Custom Component and Custom UIComponent are same in Flex ??
    Because i have created some  Custom Components based on Form Container based on my business screens .
    Does they both Custom Component and Custom UIComponent mean the same ??
    Please tell me .
    Thanks in advance

    There seems to be a little confusion here. Think of it this way:
    A basic UIComponent by itself is not visible; you can add something you can see to it to make a visual custom component. For example, a ComboBox component is a UIComponent with a ComboBox added to it.
    The UIComponent is the lightest weight component available from which you can create other components. I use it as the base for custom components that the user cannot see, like a data manager.
    HTH,
    Carlos

  • Custom Events and Scheduling more than once

    Hi,
    in BO 4.1, I successfully triggered WebI Report instance generation by a "Custom Event" through scheduling.
    Now, we have the requirement that the report should not be triggered only once but always when the event is triggered.
    At first glance, this looks tricky bc. in order that the report "reacts" to the event, the report itself must be scheduled with the event (it gets an instance "pending" that "wait + reacts" to the event). So it looks like we need schedule the report always manually with "event" before it is ready to react to the event specified in the scheduling.
    Is there any user-friendly trick to make the report react upon every fired event without having to "schedule" the report manually with the event?
    (Similar to schedule daily, just that the event is the trigger, note a daytime...)
    Best Regards

    Hi Florian,
    What is the frequency set under Recurrence option for the report instance?
    Can you give an idea like after how much time the event can be triggered?
    For example, if you are expecting the event to change in an hour, you can schedule the recurrence as hourly or you can specify something like 0 hours and 15 minutes or something like that.
    In that case, once the event is fired, your report instance will be ready to trigger after 15 minutes for the next run.
    Would suggest you to sync with the BO administrator as concurrent triggering of large number of instances can give load on Job Servers.
    Hope it will help in some way.
    Regards,
    Yuvraj

  • Creating a Custom Event Log View Shortcut on a server desktop for an admin

    Good morning,
    We have a new admin starting and I would like to create custom event log view shortcut on there desktop for each server they need to check. Is there a way to do this in Server 2012 and Server 2008?
     I have figured out how to create a shortcut of the Application and System log, but not Custom Views. Thanks.

    Hi,
    Based on my research, you can create a custom view like
    this.However, I tried miltiple ways to create a shortcut of the custom view of the event viewer and no result. I can only create a shortcut of the event viewer. You may need a script can achieve that.
    Best regards,
    Susie

  • Passing Object when custom Event is fired

    Hi,
    I need to pass an object from one page flow to other.
    I have referred to e-docs of bea. In a custom event, you can pass form beans.
    The object I need to pass is an hashmap. I can very well set it ina form bean and pass it, but that does not sound good creating a formbean just for passing object.
    Is there any better method to pass objects from Controller to other?
    Note:
    I am not invoking controller by giving its relative path in forward.
    I am using event handlers and custom events.
    Please reply,
    Suman

    I'm using Netweaver Developer Studio 7.1 SP03 PAT0005.
    Do someone knows if this version produces code that has some bugs related to custom event firing?
    This bug that I'm experiencing seems non deterministic and is driving me crazy.
    Thank you,
    Pietro
    Edited by: pietro.m on Oct 28, 2010 4:40 PM

  • Why override custom event-and when to override it?

    Hi guys..
       I always have a question about override custom event. I am not sure why or what do to inside override function. I searched google but didn't get too many feedbacks.
    Also, my projects seem work fine even though I use my custom event without override. Anyone could explain it? I appreciate if someone can light me up.

    Yes, it's a good practice to override the clone function of the superclass but you're not really overriding your custom event. Guess I didn't say it well before. Just google something like "Flex override clone function" and you'll be taken to the livedocs, most likely, where you'll find this paragraph
    You are required to override the Event.clone() method in your subclass. The clone() method returns a cloned copy of the event object by setting the type property and any new properties in the clone. Typically, you define the clone() method to return an event instance created with the new
    operator.
    I've not really thought about it before but I assume that's in case you want to extend your class. Anyway, you can pretty blindly just include that override of the clone function and not get into trouble. It's just saying, hey, if something is dealing with this custom event, don't return a copy of the superclass - the Event class - return a copy of this custom event that I've created to extend the Event class to add special functionality.

  • Query for Turnover per Customer / article and from wich agent in one file.

    Hello Experts -  basicly the subject tells it all, what I whant to see in the query is:
    Turnover Per Customer wich articles and wich agent is responsible for the customer.
    Many thanks in advance.

    Hi,
    Actually there are two field in the INV1 table
    1) Price = Net Price (after the adjustment of the Discount at row level)
    2) pricebefdi = Gross Price ( which does not include the discount at the row level)
    I have amended the query again based on the above fields :
    select distinct t0.CardName as 'Business Partner Name',
    CASE WHEN t1.discprcnt != 0 then ROUND(SUM((t1.Quantity*t1.PriceBefDi)*((100-t1.DiscPrcnt)/100)),2)
    WHEN t1.DiscPrcnt = 0 then ROUND(SUM((t1.Quantity*t1.PriceBefDi)*((100-t0.DiscPrcnt)/100)),2)
    WHEN t1.DiscPrcnt !=0 and t0.DiscPrcnt != 0 THEN
    ROUND(SUM((t1.Quantity*t1.price)*((100-t0.DiscPrcnt)/100)),2)
    END as [Total Turnover after Discount],
    t1.DiscPrcnt as 'Discount Percentage Rows',
    T0.Discprcnt as 'Header Discount',
    t1.VatSum as 'Vat Amount', t1.Dscription as 'Item Name',
    sum(t1.Quantity) as 'Qty Sold', t3.SlpName as 'Sales Employee Name'
    from OINV t0 inner join INV1 t1 on t0.DocEntry = t1.DocEntry
    inner join OSLP t3 on t3.SlpCode = t0.slpcode
    where t0.DocDate >= '2011.01.01' and t0.DocDate <= '2011.12.31'
    Group BY t3.SlpName, t0.Cardname,t0.slpcode, t1.Dscription,t1.DiscPrcnt,t1.vatsum,
    t1.DiscPrcnt,t0.discsum,t0.discprcnt
    order by t1.Dscription
    I have incorporated the one where discount is there both on header and rows.
    Kind Regards,
    Jitin
    SAP Business One Forum Team
    Edited by: Jitin Chawla on Oct 12, 2011 11:17 AM
    Edited by: Jitin Chawla on Oct 12, 2011 11:18 AM

  • Creating a Custom event for my Component

    Hi All,
    im currently working in a swing component, and i would like to know how to give to my component the ability to react to some user changes.
    Basically im creating a DateTime Picker using NetBeans, im able to see any new property justed created on the Property Editor but i would like to know how to add my custom events on the Event Editor as well, i.e:
    monthChanged - (when the user just change the month dropdown)
    yearChanged - (when the user just change the year box)
    dayChanged - (when the user just change the selection day)
    Thanks in advance

    Thanks, i just found it also here:
    http://www.exampledepot.com/egs/java.util/CustEvent.html
    i need to define the following class:
    - Custom Listener extending the EventListener interface
    - Custom Event extending EventObject class
    and then finally add the corresponding:
    addXXXListener
    removeXXXListener
    fireXXXEvent
    in my component.
    This work Great in the NetBeans GUI Builder.
    Thanks,

  • Issues regarding Transporting the Custom codes and Text Elements

    I created a custom t-code and had some text elements for my ABAP program in DEV, I transported quality an it worked , but when i transport it production it did not transport the custom code and the text elements.  Can u guys give me steps to take for the custom code and the text to be transported sucessfully??

    Hi,
    Please check whether the Tcode and Text elements are assigned to the particular Transport Request number. If it is an enhancement that Tcode and Text elements might be there in QA before itself and so this is working. You need to add the TCode manually while transporting the request and transport it to QA and PRD.
    Thanks and Regards
    Sowmmya VB

  • How to create a custom report and include multiple extended CRM database?

    I have created a number of CRM databas extensions and applied all there fields to my contacts and cases.
    I might have for example:
    - Additional address details
    - Business information
    - Quote Details
    - Trade Referees
    I know how to run a custom report and that I can select any one of these extra CRM databases as a filter and included them in the report. Is there a way though to add more than one (preferrably all) of the extra CRM databases to the report?
    The onely ways I can see it work is by either include all fields in one extra CRM database (not ideal) or bu running multiple reports and merge them somehow in Excel.
    Is there another way that I am not aware off?
    Thanks for your help,
    Jerun

    Hi Jerun,
    There's no way to do that. You'll need to run separate reports and merge them in Excel.
    -m

Maybe you are looking for

  • Open Process Orders take-over when going-live

    Hello PP People Does anyone have any experience/recommendation about the transition/take-over of open process orders from a legacy system to SAP when going live ? These process orders are started in the legacy system and should arrive in a partially

  • Planned order type

    Dear All, Can someone please explain me what are the planned order types and the use use of each types. Are they specific to any order types or is there any relation exists between two..? Regards A

  • Problem running embeded OC4J from JDeveloper 11g TP 3

    I've just downloaded JDeveloper 11g Technical Preview 3. Unzipped it and ran. IDE runs ok, but when I try to run Web project on embedded OC4J, I got exceptions and the server never starts (exception text included on the bottom). Here is the way to re

  • Difference in Document check transactions in GTS

    Hi All, Kindly provide some details for below transactions which are used for document check in GTS and the difference in the functionality of the transactions. 1. /SAPSLL/MENU_LEGALR3 2. /SAPSLL/DS_D_SD0A_R3 3. /SAPSLL/SPL_CHSC2LO 4. /SAPSLL/SPL_CHS

  • T500 under 64-bit Vista: can't get switchable graphics to work

    The BIOS is set to enable Selectable Graphics, and all four drivers show up in the Display Properties window, but there is no way to choose or enable Selectable Graphics that I can find. I left click on the battery icon, but there is no Selectable Gr