Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4760077
Votes 0
Synopsis Font sizes in JDK1.4 differ in table cells for editing and rendering
Category java:classes_swing
Reported Against 1.4
Release Fixed
State 11-Closed, duplicate of 4419964, bug
Priority: 4-Low
Related Bugs 4419964
Submit Date 08-OCT-2002
Description




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 :  customer  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) 
======================================================================
Work Around
Set the font of the TableCellEditor to match that of the table.
  xxxxx@xxxxx   2002-10-18
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.
  xxxxx@xxxxx   2003-09-11
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang