-
Bug
-
Resolution: Not an Issue
-
P2
-
None
-
1.3.0_02
-
None
-
x86
-
windows_2000
The attached program shows an JInternalFrame with a JTextArea in it. If you
compile this with JDK 1.3.1_02 (1.3.1_02-b02), you will see that there is no caret in the JTextArea. You can type but there is no caret. You can get the caret back by switching to another application (ALT-TAB) and then press ALT-TAB again to go back.
On JDK 1.4 (1.4.0-b92) it behaves different, you can not type at all in the JTextArea. Switching from application does not help either.
You can make the application work with both JDK's if you change the "extends
JWindow" to "extends JFrame". For our application we need to able to use
JWindow.
The test program is tested against Windows 2000 Professional.
//TestInternalFrameCuror.java
import javax.swing.*;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
import java.awt.Component;
import java.awt.Window;
/**
* This class shows the bug with the invisible caret in a JTextArea with an
* internal frame
*/
public class TestInternalFrameCursor extends JWindow
{
public static void main( String[] args )
{
TestInternalFrameCursor window = new TestInternalFrameCursor();
window.setSize( 300, 300 );
window.setVisible( true );
}
public TestInternalFrameCursor()
{
super();
setContentPane( new JDesktopPane() );
final JInternalFrame internalFrame = new JInternalFrame( "Title", true, true );
JPanel panel = createPanel();
internalFrame.getContentPane().add( panel );
getContentPane().add( internalFrame );
internalFrame.addInternalFrameListener( new InternalFrameAdapter()
{
public void internalFrameClosed( InternalFrameEvent e )
{
System.exit( 0 );
}
} );
internalFrame.pack();
internalFrame.setVisible( true );
}
private JPanel createPanel()
{
JPanel panel = new JPanel();
JTextArea textArea = new JTextArea( 5, 25 );
panel.add( new JScrollPane( textArea ) );
return panel;
}
}
compile this with JDK 1.3.1_02 (1.3.1_02-b02), you will see that there is no caret in the JTextArea. You can type but there is no caret. You can get the caret back by switching to another application (ALT-TAB) and then press ALT-TAB again to go back.
On JDK 1.4 (1.4.0-b92) it behaves different, you can not type at all in the JTextArea. Switching from application does not help either.
You can make the application work with both JDK's if you change the "extends
JWindow" to "extends JFrame". For our application we need to able to use
JWindow.
The test program is tested against Windows 2000 Professional.
//TestInternalFrameCuror.java
import javax.swing.*;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
import java.awt.Component;
import java.awt.Window;
/**
* This class shows the bug with the invisible caret in a JTextArea with an
* internal frame
*/
public class TestInternalFrameCursor extends JWindow
{
public static void main( String[] args )
{
TestInternalFrameCursor window = new TestInternalFrameCursor();
window.setSize( 300, 300 );
window.setVisible( true );
}
public TestInternalFrameCursor()
{
super();
setContentPane( new JDesktopPane() );
final JInternalFrame internalFrame = new JInternalFrame( "Title", true, true );
JPanel panel = createPanel();
internalFrame.getContentPane().add( panel );
getContentPane().add( internalFrame );
internalFrame.addInternalFrameListener( new InternalFrameAdapter()
{
public void internalFrameClosed( InternalFrameEvent e )
{
System.exit( 0 );
}
} );
internalFrame.pack();
internalFrame.setVisible( true );
}
private JPanel createPanel()
{
JPanel panel = new JPanel();
JTextArea textArea = new JTextArea( 5, 25 );
panel.add( new JScrollPane( textArea ) );
return panel;
}
}
- relates to
-
JDK-4109910 When a JInternalFrame is activated, focus is not transferred to its children.
- Resolved
-
JDK-4309079 When a JInternalFrame is activated, focused JTextField doesn't show cursor.
- Resolved
-
JDK-4345625 JTextArea caret becomes invisible; text becomes unselectable
- Resolved