-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
1.4.1
-
Fix Understood
-
x86
-
linux
Name: jk109818 Date: 02/20/2003
FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
FULL OPERATING SYSTEM VERSION :glibc-2.2.93-5, Kernel
2.4.18-14, Distribution: Red Hat Linux release 8.0 (Psyche)
ADDITIONAL OPERATING SYSTEMS : None
EXTRA RELEVANT SYSTEM CONFIGURATION :
Gnome window manager.
Bluecurve look and feel.
Focus behaviour: click to give focus.
A DESCRIPTION OF THE PROBLEM :
The focus does not always pass to the correct window when
running Swing applications compiled against J2SE 1.4.1. The
problem is not seen when the same program is compiled with
version 1.3.1 of the J2SE. The problem has become apparent
since switching to Red Hat Linux 8.0 using the Bluecurve
look and feel (Gnome window manager). My previous O.S. was
Mandrake Linux 8.1 (Gnome window manager) where no focus
problems were encountered, even when compiling with J2SE
version 1.4.1.
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.Run a Swing application.
2.Repeatedly bring up a dialog box.
3.The dialog box will frequently fail to gain the input focus.
EXPECTED VERSUS ACTUAL BEHAVIOR :
I expected the dialog box to always gain the input focus. On
many occasions the dialog box was not given the focus.
REPRODUCIBILITY :
This bug can be reproduced often.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Focus extends JFrame
{
public static void main(String[] args)
{
JFrame myFrame = new JFrame("Focus Demo");
myFrame.setDefaultCloseOperation(EXIT_ON_CLOSE);
JPanel contentPane = new JPanel();
contentPane.setPreferredSize(new Dimension(400, 300));
contentPane.setLayout(new FlowLayout());
JButton myButton = new JButton("Press for Dialog");
myButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
JOptionPane.showMessageDialog(null, "Button Pressed", "Feedback",
JOptionPane.INFORMATION_MESSAGE);
}
});
contentPane.add(myButton);
myFrame.setContentPane(contentPane);
myFrame.pack();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = myFrame.getSize();
myFrame.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
myFrame.setVisible(true);
}
}
---------- END SOURCE ----------
(Review ID: 181120)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
FULL OPERATING SYSTEM VERSION :glibc-2.2.93-5, Kernel
2.4.18-14, Distribution: Red Hat Linux release 8.0 (Psyche)
ADDITIONAL OPERATING SYSTEMS : None
EXTRA RELEVANT SYSTEM CONFIGURATION :
Gnome window manager.
Bluecurve look and feel.
Focus behaviour: click to give focus.
A DESCRIPTION OF THE PROBLEM :
The focus does not always pass to the correct window when
running Swing applications compiled against J2SE 1.4.1. The
problem is not seen when the same program is compiled with
version 1.3.1 of the J2SE. The problem has become apparent
since switching to Red Hat Linux 8.0 using the Bluecurve
look and feel (Gnome window manager). My previous O.S. was
Mandrake Linux 8.1 (Gnome window manager) where no focus
problems were encountered, even when compiling with J2SE
version 1.4.1.
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.Run a Swing application.
2.Repeatedly bring up a dialog box.
3.The dialog box will frequently fail to gain the input focus.
EXPECTED VERSUS ACTUAL BEHAVIOR :
I expected the dialog box to always gain the input focus. On
many occasions the dialog box was not given the focus.
REPRODUCIBILITY :
This bug can be reproduced often.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Focus extends JFrame
{
public static void main(String[] args)
{
JFrame myFrame = new JFrame("Focus Demo");
myFrame.setDefaultCloseOperation(EXIT_ON_CLOSE);
JPanel contentPane = new JPanel();
contentPane.setPreferredSize(new Dimension(400, 300));
contentPane.setLayout(new FlowLayout());
JButton myButton = new JButton("Press for Dialog");
myButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
JOptionPane.showMessageDialog(null, "Button Pressed", "Feedback",
JOptionPane.INFORMATION_MESSAGE);
}
});
contentPane.add(myButton);
myFrame.setContentPane(contentPane);
myFrame.pack();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = myFrame.getSize();
myFrame.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
myFrame.setVisible(true);
}
}
---------- END SOURCE ----------
(Review ID: 181120)
======================================================================
- relates to
-
JDK-6238739 Modal dialog doesn't always get focus
-
- Closed
-