-
Bug
-
Resolution: Fixed
-
P4
-
1.3.1_01, 1.4.0, 1.4.1, 1.4.2, 1.4.2_07, 5.0
-
b36
-
generic, x86, sparc
-
generic, solaris_8, windows_nt, windows_2000, windows_xp
FULL PRODUCT VERSION :
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)
FULL OS VERSION :
Microsoft Windows XP [verzi^?szßm: 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The keyboard focus disappeard with the closed internal frame. See the test code.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute the attached test code.
1. Selected the Internal frame(click on the header of it or ...)
2. Selected the Menu/Close menuitem, which close the internal frame
3. The keyboard focus has been lost. Check the debug lines on the output where is the focus.
ACTUAL -
The keyboard focus has been disappeard with closed internal frame.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* FocusTest.java
*
* Created on 2003. jM-^Tnius 13., 12:38
*/
package TEST;
import java.awt.Component;
import java.awt.KeyboardFocusManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import javax.swing.Timer;
public class FocusTest extends javax.swing.JFrame {
private JInternalFrame jInternalFrame1;
/** Creates new form FocusTest */
public FocusTest() {
initComponents();
jInternalFrame1 = new JInternalFrame();
jInternalFrame1.setVisible(true);
jInternalFrame1.setBounds(0, 0, 270, 240);
jInternalFrame1.getContentPane().addFocusListener( new FocusListener() {
public void focusGained(FocusEvent e) {
System.out.println("contentpane of internal frame GAINED the focus");
}
public void focusLost(FocusEvent e) {
System.out.println("contentpane of internal frame LOST the focus");
}
});
jDesktopPane1.add(jInternalFrame1, javax.swing.JLayeredPane.DEFAULT_LAYER);
Timer timer = new Timer(1500, new ActionListener() {
public void actionPerformed(ActionEvent e) {
Component comp = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
if (comp == null)
System.out.println("Focus on NULL");
else {
Component temp = comp.getParent();
while (temp != null && !(temp instanceof JInternalFrame) && !(temp instanceof JFrame))
temp = temp.getParent();
System.out.println("Focus on "+comp.getClass()+" Parent: "+(temp == null ? "null" : temp.getClass().toString()));
}
}
});
timer.start();
setSize(400, 300);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {
jDesktopPane1 = new javax.swing.JDesktopPane();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
getContentPane().add(jDesktopPane1, java.awt.BorderLayout.CENTER);
jMenu1.setText("Menu");
jMenuItem1.setText("Close frame");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem1);
jMenuBar1.add(jMenu1);
setJMenuBar(jMenuBar1);
pack();
}
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
// Add your handling code here:
jInternalFrame1.setVisible(false);
jInternalFrame1.dispose();
jInternalFrame1 = null;
System.out.println("ClosED the internal frame");
}
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {
System.exit(0);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
new FocusTest().show();
}
// Variables declaration - do not modify
private javax.swing.JDesktopPane jDesktopPane1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenu jMenu1;
// End of variables declaration
}
---------- END SOURCE ----------
(Review ID: 187979)
======================================================================
- duplicates
-
JDK-4748757 1.4.1 REGRESSION: JInternalFrame does not always minimize with CTRL+F9
-
- Closed
-
-
JDK-4917166 PIT: Ctrl+ F is not working properly in JInternalFrame
-
- Closed
-
-
JDK-4432398 Keyboard navigation doesn't respond in certain cases for Internal Frames
-
- Closed
-
-
JDK-4793752 Closing a JInternalFrame won't properly give focus to the next JInternalFrame
-
- Closed
-
- relates to
-
JDK-4864718 After minimizing all JInternalFrames the Menu can't be activated by F10
-
- Closed
-
-
JDK-4801152 Various Focus problems with JInternalFrame
-
- Closed
-
-
JDK-4833667 Deiconizing a JInternalFrame with double-click moves focus
-
- Open
-
-
JDK-6325652 Iconified JInternalFrame does not restore when Ctrl+F5 is used
-
- Resolved
-