How to block action events?

Hi,
how can i block an event call from GUI?
Imagine i have a button on a page.
The click on this button call an action listener "buttonClicked".
I want to call this action listener only in the first click.
Then, while this method do something, the next clicks on this button do not call the action listener.
So, after the method ends his execution, i enable the button clicks again.
Is there any way to do that?
Thanks.

I don't know if this is the best solution, but what I did was to pass the components as arguments in the action listener classes. Every time you invoke an action listener for component A that needs to influence component B, pass component B as an argument to a custom setComponentB(componentB) method in B's action listener.
Here's an example of my code that deals with this. The code implements a database search that displays the results as a list in a scrollable window.
class MainGUI
public static void main (String [] args)
JButton searchButton = new JButton();
JList resultList = new JList();
JScrollPane sp = new JScrollPane(resultList);
SearchButtonListener sbl = new SearchButtonListener();
sbl.setTarget(resultList);
searchButton.addActionListener(sbl);
class SearchButtonListener implements ActionListener
private JList target;
void setTarget(JList target)
this.target = target;
public void actionPerformed(ActionEvent e)
// perform database search and store results in Vector resultVector
target.setListData(resultVector);
Hope this helps.

Similar Messages

  • LoadMovie - How to block background events

    Hello,
    I use loadMovie to load a movie into a current movie clip,
    the movie is
    currently on the top, but how to block other objects/events
    so that only
    if this movie is closed, other can interact?
    I mean the loaded movie should be `modal`
    Thanks.

    Not sure if this is what you mean but basically you have a
    movie clip on top of other objects that can have mouse interaction
    in them. You want to prevent those objects from having mouse events
    happening when this current movie clip is on top of them.
    In as2 unless you can turn the visibility of everything in
    the back to 'false' you need to create a movieclip/button that
    act's like a click blocker. It will lie between the current
    movieclip and everything behind it.
    create movielclip called clickblocker and give it this code:
    clickBlocker.onRelease = function () : Void {};
    clickBlocker.useHandCursor = false;
    so basically it acts like a button that does nothing and
    prevents the mouse cursor from turning into a hand.

  • How to remove Action Event programatically

    Can i remove the Action Event programatically. Please provide the query for the same.

    Hi ,
    you can not remove Action Event programatically, although you can try to modify theexisting event using below code
    trashCanImageBean.setFireActionForSubmit ("delete",
    params, paramsWithBinds,false, false);
    so that the previous event may stop working , I never tried this , but an attempt can be done .
    Thanks
    Pratap

  • How do you kick-off an action/event before a JSF Portlet is rendered?

    Hi,
    I am creating JSR-168 Portlets using Sun RI 1.1 and need the ability to call an action (ie. method) of the JSF Portlet before it is rendered. Any ideas how to do this?
    Scenario To Resolve
    If a customer is on the Check-Out Portal Page, the check-out portlet will initially display the shopping cart information.
    The customer will then click buy and the portlet will display a confirmation page.
    Now, if the customer decides to do additional shopping (ie. place a second order).
    The customer will navigate to a different Portal Page to browse items.
    Once the customer is done shopping, the customer will click Check-Out and the Portal will display the Check-Out Portal Page. Currently, when the check-out portlet is rendered, the portlet is automatically rendering the confirmation page (ie. the last state of the check-out portlet).
    Question
    How can I control the state of the portlet so that the initial state of the portlet is rendered (ie. the shopping cart information)?
    - Is there something built into the JSR-168 Spec? Or, Sun's JSF RI 1.1 that will enable me to kick-off an action/event before a JSF Portlet is rendered?
    - If this functionality is not built in, has anyone faced this challenge? If so, how did you extend the framework to resolve it?

    Hi,
    I am creating JSR-168 Portlets using Sun RI 1.1 and need the ability to call an action (ie. method) of the JSF Portlet before it is rendered. Any ideas how to do this?
    Scenario To Resolve
    If a customer is on the Check-Out Portal Page, the check-out portlet will initially display the shopping cart information.
    The customer will then click buy and the portlet will display a confirmation page.
    Now, if the customer decides to do additional shopping (ie. place a second order).
    The customer will navigate to a different Portal Page to browse items.
    Once the customer is done shopping, the customer will click Check-Out and the Portal will display the Check-Out Portal Page. Currently, when the check-out portlet is rendered, the portlet is automatically rendering the confirmation page (ie. the last state of the check-out portlet).
    Question
    How can I control the state of the portlet so that the initial state of the portlet is rendered (ie. the shopping cart information)?
    - Is there something built into the JSR-168 Spec? Or, Sun's JSF RI 1.1 that will enable me to kick-off an action/event before a JSF Portlet is rendered?
    - If this functionality is not built in, has anyone faced this challenge? If so, how did you extend the framework to resolve it?

  • How to block execution of event listeners

    Hi all,
    JDev version : 11.1.1.6
    My requirement is that I want to block all event listeners like ActionListeners, SelectionListeners, DisclosureListeners, RowDisclosure listeners when the screen is opened in readonly mode.
    I could block ActionListeners by disabling command links and command buttons etc.
    But there's no way to block SelectionListeners, DisclosureListeners, RowDisclosure listeners.
    So Is there any common code which can block all listeners?
    Or is there any EventController or something like that which will allow me to control event execution?

    I would have if it was just one screen.
    There are hundreds of screens.
    Anyways, can't I use any javascript to do this? There are some interfaces like EventListeners , classes like EventConsumer etc. Do none of them provide feature to block event listeners?

  • How to set fire action event for particular rows in a table

    HI All,
    I have a requirement in which I want to set fire action event for particular rows in a table based on some condition.
    The table has columns like fullname,employee id etc.
    So i want to set fire action event for particulars rows only which will saisfy some condition.

    Atanu,
    Your approach(setting fire action for few rows) seems not possible. Better to go ahead with workaround.
    Do you want this functionality in processRequest(while page loading) or processFromRequest(on some event) method ? Give more explanation regd. your requirement ?
    In either case loop through the rows and when your condition is met write the action to be performed in controller.
    Regards,
    Anand

  • How do I retain Jbutton text for action event & set img icon on Jbutton

    I need to retain the text on my button as I use this to identify the action event in actionPerformed method when the button is pressed.
    Hoe do I add an image icon to the Jbutton without effecting this?
    [/b]
    class CalcPanel extends JPanel
        implements ActionListener, CurrencyVals
    //currency panel data members
        JButton[] cb = new JButton[4];
    JPanel cbkeys = new JPanel(new GridLayout(4,1));
    //Toolkit tk = Toolkit.getDefaultToolkit();
        //Image img = tk.getImage("D:/temp/ausflag.jpg");
    public CalcPanel(){
    ImageIcon b = new ImageIcon("D:/temp/ausflag.jpg","AUS");
        cb[AUS]= new JButton(b);  //cb[AUS]= new JButton("AUS");
          cbkeys.add(cb[AUS]);
          cb[AUS].addActionListener(this);
    setLayout(new BorderLayout());
        add(display, BorderLayout.NORTH);
        add(keys, BorderLayout.CENTER);
        add(cbkeys, BorderLayout.EAST);
        add(label, BorderLayout.SOUTH);
        public void actionPerformed(ActionEvent evt){
          Object source = evt.getSource();
          int id;
          if (keyBoard) {
            if (source instanceof JButton) {
              String s = ((JButton)source).getText();
    [/b]Regards
    Synfield

    if(keyBoard) { ??! [/b]... do have cause to feel flattered?
    Copy and paste this and save a small eg;- 25px high x 50px wide Jpeg image in the same file and call it "new.jpg", then study it, this posted program (again?) to see where your code went astray.
    THEN, figure out what you want to do with your code ...keep at it!
    Sue x
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ButtonIcon extends JFrame implements ActionListener {
    String []str ={"abc","def","ghi","jkl","mno","pqr","st","uvw"};
    JButton b[] = new JButton[str.length];
       JButton on = new JButton("ON");
       JButton off = new JButton("OFF");
       JButton picture;
       JPanel panel;
       String str2="";
       Font font = new Font("Comic Sans MS" ,0, 14);
       boolean keyBoard;
       ImageIcon icon = new ImageIcon("new.jpg");
    public ButtonIcon(){
       Container c = getContentPane();
       panel = new JPanel();
       panel.setLayout(new FlowLayout());
       picture = new JButton(icon);
       for (int j=0; j<=str.length-1; j++){
             b[j]= new JButton(str[j]);
             b[j].setFont(font);
             panel.add(b[j]);
             b[j].addActionListener(this);
       on.addActionListener(this);
       off.addActionListener(this);
       panel.add(on);
       panel.add(off);
       panel.add(picture);
       c.add(panel);
       public void paint (Graphics g) {
          super.paint (g);
          Graphics2D G = (Graphics2D) g;
          G.setColor(Color.red);
          G.setFont(font);
          G.drawString(str2, 25, 150);
    public void actionPerformed(ActionEvent evt){
        String command = evt.getActionCommand();
        if (keyBoard) {
           if (evt.getSource() instanceof JButton ) {
               str2 += command;
           if (evt.getActionCommand().equals("OFF")) str2 = "";
        if(command.equals("ON")) keyBoard = true;
        if(command.equals("OFF")) keyBoard = false;
    repaint();
    public static void main (String []args){
       ButtonIcon boo = new ButtonIcon();
       boo.setSize(300,200);
       boo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
       boo.setVisible(true);

  • How to Call action Listener from Mouse Listener event

    One class (class 1)implements mouse listener and responds to a mouse events.
    As part of that response it needs to call a variable set method in another class (class 2)and also have that setMethod call it's own ActionPerformed.
    Seems the problem is I don't have aaction event to pass
    I only have a mouse event. As follows:
    class 1
    public void mousePressed(MouseEvent e) {
    int y1=Math.abs(e.getY()-y);
    this.sourceReference.setVar(y1);
    repaint();
    class 2
    int var;
    public void setVar(int y)
    var=y;
    this.ActionPerformed(?? ); //This is what I want to do
    Same question slightly different.
    From class 1 I scould first call the setVar method
    and then issue a call to class 2's ActionPerformed.
    But again I don't seem to have the proper action event e to pass it.
    Thanks

    Do you need any information from an ActionEvent that you'd be calling from the MouseEvent (ie the action command, or somethig) or can you just have the actionPerformed method just call a different method that doesn't need an ActionEvent?
    public void actionPerformed(ActionEvent e) {
    this.doActionStuff();
    public void doActionStuff() {
    // does what you want the action event to do
    Then from the mousePressed method you can just call the doActionStuff method.
    I'm not sure if this helps or not, hope it does.
    Scott

  • How to pass params to Action Event handler in treeNode?

    Trying to use Tree in portlet I found impossible to determine selected node. (bug # 6354989).
    But I can (despite what is written in manual) use Action Event Handler. It works now (at least, I hope so).
    But I generate tree dynamically and cannot write event handlers for all its nodes. May be there's a way to write one event handler but distinguish node that triggered it? May be by passing additional params to handler?

    The tree component does not work well in portlets. This is a known problem.
    It uses cookies to pass the value of the selected node, but cookies do not work inside of portlets. So, the methods that would normally tell you which node is selected, return nothing. There are also no javascript properties which would allow you to output javascript to store the value somewhere in the page.
    Unfortunately there is no workaround for the bug you mentioned so far so far.
    Rose

  • How to add to viewPlatformBehavior an Action Event - a button press

    And the main problem I have is to by pressing buttons to change the Viewing Platform?
    I made same transformation to object, which reacts to key pressin:
    public class LewoPrawo extends Behavior{
        private TransformGroup targetLP;
        private Transform3D wysuwanie = new Transform3D();
        private float krok2 = (float) 0.0;
         // create LewoPrawo
        LewoPrawo(TransformGroup targetLP){
        this.targetLP = targetLP;
         public void initialize(){           
                this. wakeupOn(new WakeupOnAWTEvent(AWTEvent.KEY_EVENT_MASK));
        public void processStimulus(Enumeration enumeration){
            this.wakeupOn(new WakeupOnAWTEvent(AWTEvent.KEY_EVENT_MASK));
                KeyEvent event = (KeyEvent) ((WakeupOnAWTEvent) enumeration.nextElement()).getAWTEvent()[0];
               if (event.getKeyCode() == KeyEvent.VK_Q) {
                   krok2 += 0.01;
               if (event.getKeyCode() == KeyEvent.VK_W) {
                   krok2 -= 0.01;
               wysuwanie.set(new Vector3f(krok2, 0.0f, 0.0f));
               wysuwanie.mul(przewrocenie);
               targetLP.setTransform(wysuwanie);
        }And this is the one that I made up to move the viewing platform, but it doesn't work!!!
    public class Perspektywa extends ViewPlatformBehavior{
    private TransformGroup targetVP;
    private Transform3D obrot_obserwatora = new Transform3D();
    private double kat=0.0;
    //create Perspektywa
         Perspektywa(){
         public void initialize(){
         this.wakeupOn(new WakeupOnAWTEvent(AWTEvent.ACTION_EVENT_MASK));
         public void processStimulus(Enumeration enumeration){
         this.wakeupOn(new WakeupOnAWTEvent(AWTEvent.ACTION_EVENT_MASK));
    ActionEvent event = (ActionEvent) ((WakeupOnAWTEvent) enumeration.nextElement()).getAWTEvent()[0];
         if (event.getSource()== przyciski[0])  {
               kat += 0.1;
           if (event.getSource() == przyciski[3]) {
               kat -= 0.1;
            obrot_obserwatora.rotY(kat);
            TransformGroup targetVP =
                simpleU.getViewingPlatform().getViewPlatformTransform();
            targetVP.getTransform( obrot_obserwatora);
    }And what's worse, action events doesnt even work when i replace key events with them, but i don;t know why ;(

    The section from the Swing tutorial on "General Rules for Using Text Components" has a sample program that does this:
    http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html
    Or, you can create a new Action using DefaultEditorKit.CopyAction

  • How to block p2p applications(Bittorent like) with AIP-SSM-10?

    Hi,
    How to block p2p application using AIP-SSM-10 working with ASA5520?AIP is on promiscuous mode.
    Thanks,
    Siva

    There are several signatures that detect p2p, for bit torrent there is 11020.0
    Yahoo triggers: 5539.0, 11200.0, 11212.0, 11217.0 & 11219.0
    etc..
    Some are disabled by default though so please ensure you enable the ones that you need.
    If you want to block these then you will have to use event actions that work in promiscuous setup for example request block connection and tcp reset. Please note that care must be taken when using these event actions.
    For more information about the event actions please refer the link below:
    http://www.cisco.com/univercd/cc/td/doc/product/iaabu/csids/csids12/idmguide/dmevtrul.htm#wp1069467

  • How to block the creation of a Sales Orders without a linked Purchase Order

    Hi. I'm trying to block the creation of a Sales Order that doesn't have a linked Purchase Order. The first thing I did is using the SBO Transaction Notification as follows:
    IF  @transaction_type = 'A' AND @object_type='17'
    BEGIN
         IF (SELECT PoPrss FROM ORDR WHERE DocEntry = @list_of_cols_val_tab_del) = 'N'
         BEGIN
              SET @error = 1
              SET @error_message = 'Purchase Order Missing...'
         END
    END
    This works good. I create the Sales Order, I tick the purchase order field on the logistics tab, I click Add, and then the purchase order window appears...
    Then, the problem begins... If I click the Cancel button, the purchase order is obviously not created, but the Sales Order is created.
    Can someone tell me how to block the creation of the sales order If the user press the cancel button on the purchase order window (and the purchase order is not created)
    As far as I can see, after clicking the add button in the sales order document, the Sales Order is created on the DB. If there's no way of blocking the creation of the Sales Order, can I avoid closing the purchase order window by the SBO_TransactionNotification? (if the purchase order has not been created)
    Thanks...

    Hi Yail,
    I think you can't close the purchase order with the stored procedure.
    Try to catch the Event when the user click on Cancel button.
    So you can list the vents with event logger : https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ede3be37-0e01-0010-1883-cd1b5293473e
    You can block the cancel button and force the user to create the purchase order.
    Hope i help you
    Best regards
    Michael

  • How to block the Creation of Mulitple Excise Invoice in J1IS

    Hi Sap Gurs,
    Can any tell me how to block the System allowing  to Create One more Excise Invoice in J1IS against Same GI Material Document no (Ref Trans Type:MATD) for Outgoing Materials ie:Stock Transfer from One Plant to onother Plant by Mvt Type 351(Single Step Procedure)
    In SD, System is not allowing to Create One more Excise Invoive against One Billing Document Untill we Cancell the same.
    I want to make it like same for the above Issue.
    Pls check it in your system and give a Feed Back.
    Thanks in advance.
    Bye
    Sathish

    Hi Yail,
    I think you can't close the purchase order with the stored procedure.
    Try to catch the Event when the user click on Cancel button.
    So you can list the vents with event logger : https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ede3be37-0e01-0010-1883-cd1b5293473e
    You can block the cancel button and force the user to create the purchase order.
    Hope i help you
    Best regards
    Michael

  • How to block a business partner...in sales order????

    Hi all,
               While generating the sales order....In the customer tab i will select one business partner from CFL,after choosing i want one particular customer to be blocked....means it should unable to post the sales order.....i know that i should write my coding in the customer tab LOST FOCUS event......can anybody suggest me the coding for this problem....
    regards,
    shangai.

    Shangai,
    How about blocking some partner from ChooseFromList of BP in Sales Order?
    Meaning that blocked some bp with criteria in Choose From List. Sample code:
    If pVal.FormType = 139 And pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
                If pVal.ItemUID = "4" Then
                    If pVal.InnerEvent And pVal.Before_Action Then
                        BubbleEvent = False
                        Dim oForm As SAPbouiCOM.Form
                        oForm = SBO_Application.Forms.Item(FormUID)
                        Dim oCons As SAPbouiCOM.Conditions                   
                        Dim oCFL As SAPbouiCOM.ChooseFromList
                        'oCFL = oCFLs.Add(oCFLCreationParams)
                        oCFL = oForm.ChooseFromLists.Item("2")
                        oCons = oCFL.GetConditions()
                        'Note: Add the condition only once.
                        If 0 = oCons.Count Then
                            Dim oCon As SAPbouiCOM.Condition
                            oCon = oCons.Add()
                            oCon.Alias = "Cardcode"
                            oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                            oCon.CondVal = "C0001"
                            'Set your own condition here instead of the system conditions
                            oCFL.SetConditions(oCons)
                        End If
                        BubbleEvent = True
                    End If
                End If
            End If
    Regards, Yatsea

  • How to avoid the event has been repeated many times in the background

    Application, the main screen is divided into two containers:left and  right container,
    The right side of the container is divided into two containers:top and  bottom container,
    There is a button in the left container.
    Click the button, the container at lower right will using ModuleManager  load Module,  The following container load of the right of the screen  has been monitoring the container above the action.
    Problem:
    When you click the button repeatedly to load the container in the lower  right, it will create multiple instances, and can not be freed  immediately. When the above container do an action or event, there are  multiple instances of monitoring exist.
    The background will be repeat the action or event many times.
    How to avoid the event has been repeated many times in the background?
    Thanks

    Flex harUI
    multiple instances of a mxml, maybe ?

Maybe you are looking for

  • WPA/WPA2 Powerbook G4 can't connect to dome Airport Extreme

    Hi, My Security settings are now set to WPA/WPA2 Personal on my dome Airport Extreme. The only computer that can't connect to it is my 15" Powerbook G4. It shows the airport at the top, but only gives me the option of running WPA. I am running OS 10.

  • Help Needed!! - Yamaha Drum Mapping

    This has probably come up before but the things I've tried havn't seemed to work: I need to remap the Yamaha DTXplorer drums in Logic Express, as the snare is currently silent and the kick does some sort of roll. I've tried using midipipe already (wh

  • Split File in File Sender

    Hi, I have a source file that can be up to 4MB's and I want to Split it for every 10,000 records in the file. I can't use "Recordsets per Message" because my file has a single Header and multiple Detail records. Is there any way to split this message

  • Outlook 2013 treating Shared Calendars differently

    I did try to ask this in a different forum, but was pointed to this one: This question encompasses a few Microsoft products, but I think this is the best place to ask the question because the actual issue is Outlook 2013 for Windows desktop. We have

  • Import preferences and question about import

    Under Preferences/Advanced is the selection: "Copy files to iPhoto Library folder when adding to library." Should this option be selected? What does it do? When I import, neither roll nor photo name appear in the left menu window of iPhoto. Other rol