Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Order of events

Reply
Thread Tools

Order of events

 
 
marcussilfver@gmail.com
Guest
Posts: n/a
 
      05-19-2008
I am trying to distinguish between a combobox selection made
programatically and a combobox selection made by the user. I have code
like the following:

comboBox1.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent evt) {
comboBox1Clicked = true;
}
});

comboBox1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (comboBox1Clicked)
{
System.out.println("This selection was made by the user");
comboBox1Clicked = false;
}
else
System.out.println("This selection was made by the program");
}
});

This seems to be working fine. I am not confident though that it will
always do that.

In which order will events be fired? Will the mouseClicked event
always be fired before the actionPerformed event?
I need it to always work on both Windows and Mac OS.

thanks
 
Reply With Quote
 
 
 
 
Jeff Higgins
Guest
Posts: n/a
 
      05-21-2008

marcussilfver wrote:
>I am trying to distinguish between a combobox selection made
> programatically and a combobox selection made by the user. I have code
> like the following:
>
> comboBox1.addMouseListener(new MouseAdapter(){
> public void mouseClicked(MouseEvent evt) {
> comboBox1Clicked = true;
> }
> });
>
> comboBox1.addActionListener(new ActionListener() {
> public void actionPerformed(ActionEvent evt) {
> if (comboBox1Clicked)
> {
> System.out.println("This selection was made by the user");
> comboBox1Clicked = false;
> }
> else
> System.out.println("This selection was made by the program");
> }
> });
>
> This seems to be working fine. I am not confident though that it will
> always do that.
>


Just out of curiosity, can the user select items with key strokes?

> In which order will events be fired? Will the mouseClicked event
> always be fired before the actionPerformed event?
> I need it to always work on both Windows and Mac OS.
>
> thanks



 
Reply With Quote
 
 
 
 
marcussilfver@gmail.com
Guest
Posts: n/a
 
      05-23-2008
On 21 Maj, 02:59, "Jeff Higgins" <(E-Mail Removed)> wrote:
> marcussilfverwrote:
> >I am trying to distinguish between a combobox selection made
> > programatically and a combobox selection made by the user. I have code
> > like the following:

>
> > comboBox1.addMouseListener(new MouseAdapter(){
> > * public void mouseClicked(MouseEvent evt) {
> > * * *comboBox1Clicked = true;
> > * }
> > });

>
> > comboBox1.addActionListener(new ActionListener() {
> > * public void actionPerformed(ActionEvent evt) {
> > * * *if (comboBox1Clicked)
> > * * *{
> > * * * * System.out.println("This selection was made by the user");
> > * * * * comboBox1Clicked = false;
> > * * *}
> > * * *else
> > * * * * System.out.println("This selection was made by the program");
> > * }
> > });

>
> > This seems to be working fine. I am not confident though that it will
> > always do that.

>
> Just out of curiosity, can the user select items with key strokes?
>
>
>
> > In which order will events be fired? Will the mouseClicked event
> > always be fired before the actionPerformed event?
> > I need it to always work on both Windows and Mac OS.

>
> > thanks- Dölj citerad text -

>
> - Visa citerad text -- Dölj citerad text -
>
> - Visa citerad text -


No, Why do you wonder?
 
Reply With Quote
 
Jeff Higgins
Guest
Posts: n/a
 
      05-23-2008

marcussilfver wrote:
Jeff Higgins wrote:
> marcussilfver wrote:
> >I am trying to distinguish between a combobox selection made
> > programatically and a combobox selection made by the user. I have code
> > like the following:

>
> > This seems to be working fine. I am not confident though that it will
> > always do that.

>
> Just out of curiosity, can the user select items with key strokes?
>


No, Why do you wonder?

I wondered whether to categorize selection by keystroke
as user selection or programmatic selection.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM
order of events - dynamic checkbox events =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?= ASP .Net 0 08-17-2005 10:36 PM
If you get an order # does it mean the order is accepted? =?Utf-8?B?U3RldmUxMDc3?= Windows 64bit 3 05-12-2005 11:46 PM
Traversion order cf. output order in XSL Soren Kuula XML 2 02-01-2004 09:10 AM
How to Display DropDownList with preserved order (custom order) cspoh ASP .Net Web Controls 0 07-31-2003 09:19 AM



Advertisments