logo       

RE: Double Click in an ULCTextField: msg#00173

java.ulc.devel

Subject: RE: Double Click in an ULCTextField

Hi Paul,

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: ulc-developer-admin@xxxxxxxxxxxxxxx
>[mailto:ulc-developer-admin@xxxxxxxxxxxxxxx]On Behalf Of
>harrisonpf@xxxxxxxxxxxx
>Sent: Wednesday, July 19, 2006 4:52 PM
>To: ulc-developer@xxxxxxxxxxxxxxx
>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) {
}
});
}
}
}


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise