I m 执行Java Swing GUI, 该公司有两家JLabels,他在JFrame上几次展示。 为此原因,我检查了这些标签,并将其储存在一位医生身上。 在我的JFrame展期班的构造者中,我增加了一名听众:
b1.addMouseListener(new LabelMouseListener(...));
Every time I want to display the labels, I pick them from the vector and add them as a component on the frame. This works fine. And also, the listener, I added in the constructor is listening. But, there is a difference between the behavior on a Mac and on a PC. On a Mac it works completely fine, but on a PC (Win XP) I need to click the label twice before the listener reacts. The LabelMouseListener implements MouseListener and I override the mouseClicked method. Maybe it also depends on the JavaRE, because on the Mac I use the 1.6, on the Win, I use 1.7. Is this a known problem, or do you have any suggestions for the cause of the error?