Closed Bug 4259 Opened 26 years ago Closed 26 years ago

Incorrect mouse events and focus in top level Java windows when using MRJ plugin for Netscape 4.x browsers.

Categories

(Core Graveyard :: Java: OJI, defect, P3)

PowerPC
Mac System 8.0

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: Hemant.Inamdar, Assigned: beard)

Details

Lets say you create a top level window derived from Swing JFrame (version of swing doesnt matter). Lets say there are three Textfields 'A', 'B' and 'C' in a panel inside that window. I click on 'A' and then on 'B'. Now, instead of 'B' having the focus, 'A' has the focus. So, if something is typed in, it will get put in 'A' rather than 'B'. Clicking twice on 'B' gives it proper focus. This happens with all components including menus, JTrees, JTables etc. If I click on 'A' anbd then 'B', 'A' retains focus. If I click on 'C' now, 'B' will get focus. and if 'A' is clicked on, 'C' will get focus. Thus the component which has a previous mouse clicked on it will get focus and not the component on which the current mouse click occurs. The following is sample code: _______________________ TestFrame.java: import java.awt.*; import java.awt.event.*; import com.sun.java.swing.*; public class TestFrame extends JFrame implements ActionListener { public TestFrame() { Container pane = getContentPane(); pane.setLayout(new BorderLayout()); TestPanel tPanel = new TestPanel(); pane.add("Center", tPanel); Button closeBtn = new Button("Close"); closeBtn.addActionListener(this); Panel bottomPanel = new Panel(); bottomPanel.setLayout(new FlowLayout()); bottomPanel.add(closeBtn); pane.add("South", bottomPanel); pack(); } public void actionPerformed(ActionEvent e) { setVisible(false); } } ______________________________________________ TestApplet.java: import java.awt.event.*; import java.applet.*; import com.sun.java.swing.*; import java.awt.*; public class TestApplet extends JApplet implements ActionListener { TestFrame tFrame; public void init() { getContentPane().setLayout(new BorderLayout()); TestPanel tPanel = new TestPanel(); getContentPane().add("Center", tPanel); Button showBtn = new Button("Show"); showBtn.addActionListener(this); Panel bottomPanel = new Panel(); bottomPanel.setLayout(new FlowLayout()); bottomPanel.add(showBtn); getContentPane().add("South", bottomPanel); tFrame = new TestFrame(); } public void actionPerformed(ActionEvent e) { tFrame.setVisible(true); } } __________________________________ TestPanel.java import java.awt.*; import java.awt.event.*; import com.sun.java.swing.*; public class TestPanel extends JPanel { public TestPanel() { setLayout(new GridLayout(3,2)); for(int ctr=1; ctr<=3; ctr++ ) { add( new JLabel("Label " + ctr)); add( new JTextField()); } } } __________________________ test.html <body> <embed TYPE = "application/x-java-vm" NAME = "TestApplet" PLUGINSPAGE = "http://www.mozilla.org/oji/" code="TestApplet.class" width="200" height="75" > </embed> </body>
Assignee: amusil → beard
QA Contact: 4082 → 4386
Status: NEW → ASSIGNED
This was caused by not calling JMFrameMouseOver on top level frames. Swing seems to need to get mouse enter/exit events to do proper event delivery. I've got a fix for this.
fix will be in 1.0d6 build.
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Target Milestone: M5
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.