| Other |
|---|
| 1.4.0 rc1Fixed |
|
Duplicate :
|
|
|
Duplicate :
|
|
|
Duplicate :
|
|
|
Relates :
|
|
|
Relates :
|
Name: rmT116609 Date: 09/27/2001
java version "1.4.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta2-b77)
Java HotSpot(TM) Client VM (build 1.4.0-beta2-b77, mixed mode)
I have a JFrame containing a JComboBox (north) and a JPanel (center). Clicking
on the JComboBox drops down the list of items, when I click on one of these
items the mouse click event is sent to the JPanel. (when the JComboBox drops
down it overlaps the JPanel). This doesn't seem to happen in an earlier beta
of 1.4 I have on another machine (sorry can't get -version at the moment).
Demo:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TestJComboBox extends JFrame
{
public static void main(String[] args)
{
TestJComboBox tjcb = new TestJComboBox();
}
public TestJComboBox()
{
JComboBox combo = new JComboBox();
JPanel panel = new JPanel();
combo.addItem("java");
combo.addItem("rocks");
panel.addMouseListener(new QuitMouseListener());
getContentPane().setLayout(new BorderLayout());
getContentPane().add(combo, BorderLayout.NORTH);
getContentPane().add(panel, BorderLayout.CENTER);
setSize(800, 600);
setVisible(true);
}
class QuitMouseListener extends MouseAdapter
{
public void mouseClicked(MouseEvent ev)
{
System.err.println("you clicked the panel!");
System.exit(0);
}
}
}
(Review ID: 132761)
======================================================================
|