JDK-4760077 : Font sizes in JDK1.4 differ in table cells for editing and rendering
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2002-10-08
  • Updated: 2003-09-11
  • Resolved: 2003-09-11
Related Reports
Duplicate :  
Description

Name: sv35042			Date: 10/08/2002


FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

FULL OPERATING SYSTEM VERSION : Microsoft Windows XP
[Version 5.1.2600]


ADDITIONAL OPERATING SYSTEMS : Windows NT/2000



A DESCRIPTION OF THE PROBLEM :
Since JDK 1.4 beta, when I click in my table cells to edit
(they use JTextFields for both editing and rendering) the
font size increases slightly. This shifts all the
characters to the right, and the insertion cursor is then
inserted in the wrong place!

This is very aggravating for users, as they watch the text
jump a little when they click in a table cell.

This seems to occur with all Windows versions, but did NOT
occur in 1.3.

REGRESSION.  Last worked in version 1.3.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a table with JTextField editor and renderer.
2. Click in the text field to start editing.
3.

EXPECTED VERSUS ACTUAL BEHAVIOR :
I expect the cursor to be put between the two characters on
which I click, but since the font size changes, the cursor
gets inserted in the wrong place!

This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;

public class Test {
	public static void main(String[] args) throws Exception {
		UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName
());
		JFrame frame = new JFrame("Bad Font Sizes in JTextField");
		String[][] data = new String[][] { { "Looooooooooong Row
1", "Looooooooooong Value 1" }, { "Looooooooooong Row 2", "Looooooooooong Value
2" }};
		JTable table = new JTable(data, new String[] { "Header
1", "Header 2" });
		frame.getContentPane().add(table);
		frame.pack();
		frame.setVisible(true);
	}
}

---------- END SOURCE ----------

CUSTOMER WORKAROUND :
Use JDK 1.3.
(Review ID: 143271) 
======================================================================

Comments
EVALUATION This was happening because we were getting the wrong fonts for table and textfields. As a result of the fix for 4419964 we are now picking up the right font, so that there isn't a problem with size anymore. ###@###.### 2003-09-11
11-09-2003

WORK AROUND Set the font of the TableCellEditor to match that of the table. ###@###.### 2002-10-18
18-10-2002