-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.1.5, 1.3.0
-
x86
-
windows_nt
orig synopis: "Lost Second Event"
Name: eyC74480 Date: 05/25/98
/*
A basic extension of the java.applet.Applet class
*/
import java.awt.*;
import java.applet.*;
I am trying to catch the two events (item state
change and mouse click) at the same time in the
AWT ListBox components. It always catch the item
state change event, but sometimes it fails to
catch the mouse click event. I have enclosed the
source codes. Please review and let me know if
you can provide a solutions. Thanks in advance.
Kind Regards,
-- Seung Hyun
public class Applet1 extends Applet
{
public void init()
{
setLayout(null);
setSize(426,266);
list1 = new java.awt.List(0);
list1.addItem("item1");
list1.addItem("item2");
list1.addItem("item3");
list1.addItem("item4");
list1.addItem("item5");
list1.addItem("item6");
list1.addItem("item7");
list1.addItem("item8");
list1.addItem("item9");
list1.addItem("item10");
list1.addItem("item11");
list1.addItem("item12");
list1.addItem("item13");
list1.addItem("item14");
list1.addItem("item15");
add(list1);
list1.setBounds(15,13,73,169);
textArea1 = new java.awt.TextArea();
textArea1.setBounds(105,13,305,199);
add(textArea1);
button1 = new java.awt.Button();
button1.setLabel("Clear");
button1.setBounds(15,190,73,22);
button1.setBackground(new Color(12632256));
add(button1);
SymItem lSymItem = new SymItem();
list1.addItemListener(lSymItem);
SymMouse aSymMouse = new SymMouse();
list1.addMouseListener(aSymMouse);
SymAction lSymAction = new SymAction();
button1.addActionListener(lSymAction);
}
java.awt.List list1;
java.awt.TextArea textArea1;
java.awt.Button button1;
public static void main(String args[])
{
Applet1 applet =
new Applet1();
applet.setVisible(true);
}
class SymItem implements java.awt.event.ItemListener
{
public void itemStateChanged(java.awt.event.ItemEvent event)
{
Object object = event.getSource();
if (object == list1)
list1_ItemStateChanged(event);
}
}
void list1_ItemStateChanged(java.awt.event.ItemEvent event)
{
textArea1.append("Item State Changed - " + list1.getSelectedItem() + "\n");
}
class SymMouse extends java.awt.event.MouseAdapter
{
public void mouseClicked(java.awt.event.MouseEvent event)
{
Object object = event.getSource();
if (object == list1)
list1_MouseClicked(event);
}
}
void list1_MouseClicked(java.awt.event.MouseEvent event)
{
textArea1.append("Mouse Clicked - " + list1.getSelectedItem() + "\n");
}
class SymAction implements java.awt.event.ActionListener
{
public void actionPerformed(java.awt.event.ActionEvent event)
{
Object object = event.getSource();
if (object == button1)
button1_ActionPerformed(event);
}
}
void button1_ActionPerformed(java.awt.event.ActionEvent event)
{
textArea1.setText("");
}
}
(Review ID: 29430)
======================================================================
Name: eyC74480 Date: 05/25/98
/*
A basic extension of the java.applet.Applet class
*/
import java.awt.*;
import java.applet.*;
I am trying to catch the two events (item state
change and mouse click) at the same time in the
AWT ListBox components. It always catch the item
state change event, but sometimes it fails to
catch the mouse click event. I have enclosed the
source codes. Please review and let me know if
you can provide a solutions. Thanks in advance.
Kind Regards,
-- Seung Hyun
public class Applet1 extends Applet
{
public void init()
{
setLayout(null);
setSize(426,266);
list1 = new java.awt.List(0);
list1.addItem("item1");
list1.addItem("item2");
list1.addItem("item3");
list1.addItem("item4");
list1.addItem("item5");
list1.addItem("item6");
list1.addItem("item7");
list1.addItem("item8");
list1.addItem("item9");
list1.addItem("item10");
list1.addItem("item11");
list1.addItem("item12");
list1.addItem("item13");
list1.addItem("item14");
list1.addItem("item15");
add(list1);
list1.setBounds(15,13,73,169);
textArea1 = new java.awt.TextArea();
textArea1.setBounds(105,13,305,199);
add(textArea1);
button1 = new java.awt.Button();
button1.setLabel("Clear");
button1.setBounds(15,190,73,22);
button1.setBackground(new Color(12632256));
add(button1);
SymItem lSymItem = new SymItem();
list1.addItemListener(lSymItem);
SymMouse aSymMouse = new SymMouse();
list1.addMouseListener(aSymMouse);
SymAction lSymAction = new SymAction();
button1.addActionListener(lSymAction);
}
java.awt.List list1;
java.awt.TextArea textArea1;
java.awt.Button button1;
public static void main(String args[])
{
Applet1 applet =
new Applet1();
applet.setVisible(true);
}
class SymItem implements java.awt.event.ItemListener
{
public void itemStateChanged(java.awt.event.ItemEvent event)
{
Object object = event.getSource();
if (object == list1)
list1_ItemStateChanged(event);
}
}
void list1_ItemStateChanged(java.awt.event.ItemEvent event)
{
textArea1.append("Item State Changed - " + list1.getSelectedItem() + "\n");
}
class SymMouse extends java.awt.event.MouseAdapter
{
public void mouseClicked(java.awt.event.MouseEvent event)
{
Object object = event.getSource();
if (object == list1)
list1_MouseClicked(event);
}
}
void list1_MouseClicked(java.awt.event.MouseEvent event)
{
textArea1.append("Mouse Clicked - " + list1.getSelectedItem() + "\n");
}
class SymAction implements java.awt.event.ActionListener
{
public void actionPerformed(java.awt.event.ActionEvent event)
{
Object object = event.getSource();
if (object == button1)
button1_ActionPerformed(event);
}
}
void button1_ActionPerformed(java.awt.event.ActionEvent event)
{
textArea1.setText("");
}
}
(Review ID: 29430)
======================================================================