Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
Name: yyT116575 Date: 12/15/2000 java version 1.3.0 Runtime Environment Standard Edition bulid 1.3.0-C, mixed mode java Hotspot client vm build 1.3.0-c, mixed mode mouseClicked Event are not delivered when 2 Internal frames are involved and when we select a component in the internal frame which didn't have the focus.. To Reproduce the problem, Compile and run the following program..Select a node on Frame 1 and then select a node on Frame 2. You will see the Console Output as Tree 1 : Mouse Pressed Tree 1 : Mouse Released Tree 1 : Mouse Clicked Tree 2 : Mouse Pressed Tree 2 : Mouse Released As u can see although the mousePressed and mouseReleased events were recived mouseClicked was not received for the Tree2.. import javax.swing.*; import java.util.*; import java.awt.event.*; public class ClickTest extends JFrame implements MouseListener { JTree tree1; JTree tree2; public ClickTest() { super(); Vector vector1 = new Vector(); vector1.add("Hello1"); vector1.add("Hi1"); Vector vector2 = new Vector(); vector2.add("Hello2"); vector2.add("Hi2"); tree1 = new JTree(vector1); tree2 = new JTree(vector2); tree1.addMouseListener(this); tree2.addMouseListener(this); JInternalFrame iFrame1 = new JInternalFrame("Frame 1"); JInternalFrame iFrame2 = new JInternalFrame("Frame 2"); JDesktopPane pane = new JDesktopPane(); iFrame1.getContentPane().add(tree1); iFrame2.getContentPane().add(tree2); iFrame1.pack(); iFrame2.pack(); iFrame1.setSize(200,200); iFrame2.setSize(200,200); pane.add(iFrame1); pane.add(iFrame2); iFrame1.show(); iFrame2.show(); getContentPane().add(pane); pack(); setSize(400,400); show(); } public void mousePressed(MouseEvent e) { if (e.getSource() == tree1) { System.out.println("Tree 1 : Mouse Pressed"); } if (e.getSource() == tree2) { System.out.println("Tree 2 : Mouse Pressed"); } } public void mouseReleased(MouseEvent e) { if (e.getSource() == tree1) { System.out.println("Tree 1 : Mouse Released"); } if (e.getSource() == tree2) { System.out.println("Tree 2 : Mouse Released"); } } public void mouseClicked(MouseEvent e) { if (e.getSource() == tree1) { System.out.println("Tree 1 : Mouse Clicked"); } if (e.getSource() == tree2) { System.out.println("Tree 2 : Mouse Clicked"); } } public void mouseEntered(MouseEvent e) {}; public void mouseExited(MouseEvent e) {}; public static void main(String[] args) { new ClickTest(); } } (Review ID: 113817) ======================================================================
|