Hello Janak

I have found the cause of my error. I still had a method in my class 
(updateValue) which shouldn't have been there. I put it there when I was 
getting the errors due to the Dispatcher problem and forgot to remove it.

Thanks for you help


ULC Extension Guide for ULC 6.1 has an example of creating ActionEvent on
the Pie Chart widget.

Nevertheless, I have created a small snippet for you which can be found at
the end of this mail.

Thanks and regards,

Janak

PS: Are you still developing for Ottomobil?

> >-----Original Message-----
> >From: [EMAIL PROTECTED]
> >[mailto:[EMAIL PROTECTED] Behalf Of
> >[EMAIL PROTECTED]
> >Sent: Wednesday, July 19, 2006 4:52 PM
> >To: [email protected]
> >Subject: [ULC-developer] Double Click in an ULCTextField
> >
> >
> >I need to perform an action when the users double click within an
> >ULCTextField. I have searched the archive but have onlyfound
> >double clicking in an ULCTable (action Listener). How do I know
> >that a user has double clicked on an ULCTextItem?
> >
> >Thanks
--------------------------

import com.ulcjava.base.application.AbstractApplication;
import com.ulcjava.base.application.ULCBoxPane;
import com.ulcjava.base.application.ULCFrame;
import com.ulcjava.base.application.ULCTextField;
import com.ulcjava.base.application.event.ActionEvent;
import com.ulcjava.base.application.event.IActionListener;
import com.ulcjava.base.client.UITextField;
import com.ulcjava.base.development.DevelopmentRunner;

import javax.swing.SwingUtilities;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

public class ActioneventOnTextFieldSnippet extends AbstractApplication {

    public void start() {

        final ULCActionTextField textField = new ULCActionTextField(20);

        textField.addActionListener(new IActionListener() {

            public void actionPerformed(ActionEvent event) {
                textField.setText("Action Performed");
            }

        });

        ULCBoxPane box = new ULCBoxPane();
        box.add(ULCBoxPane.BOX_CENTER_CENTER, textField);

        ULCFrame frame = new ULCFrame("ActioneventOnTextFieldSnippet");
        frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
        frame.add(box);
        frame.setSize(200, 200);
        frame.setVisible(true);
    }

    public static void main(String[] args) {
        DevelopmentRunner.setApplicationClass(ActioneventOnTextFieldSnippet.
class);
        DevelopmentRunner.main(args);
    }

    public static class ULCActionTextField extends ULCTextField {
        public ULCActionTextField(int i) {
            super(i);
        }

        protected String typeString() {
            return UIActiontextField.class.getName();
        }
    }

    public static class UIActiontextField extends UITextField {

        protected void postInitializeState() {
            super.postInitializeState();
            getBasicTextField().addMouseListener(new MouseListener() {

                public void mouseClicked(MouseEvent e) {
                }

                public void mouseEntered(MouseEvent e) {
                }

                public void mouseExited(MouseEvent e) {
                }

                public void mousePressed(MouseEvent e) {
                    if (isEnabled() && e.getClickCount() == 2 &&
SwingUtilities.isLeftMouseButton(e)) {
                            fireActionPerformedULC(null, e.getModifiers());
                    }
                }

                public void mouseReleased(MouseEvent e) {
                }
            });
        }
    }
}

_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer


_____________________________________________________________
NEU: Ihre Photos online verwalten, mit anderen teilen und die besten Bilder 
gleich entwickeln lassen - GRATIS für den 1. Monat (exkl. Entwicklung)
www.sunrise.ch/photoalbum
_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to