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: 6696166
Votes 0
Synopsis TitledBorder: default title position isn't changed if current Look and Feel has changed
Category java:classes_swing
Reported Against
Release Fixed 6u10(b26)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 6595814
Submit Date 30-APR-2008
Description
jdk version: 6u10
OS: any

If an application uses titled borders and starts under Numbus Look and Feel and then sets another Look and Feel (for example, Metal), all titled borders don't change their title positions.

To reproduce the problem use TitledBorderTest.java from the attachment:
1. Run the test
2. Note that it is the Metal Look and Feel and that the title position is ABOVE_TOP instead of CENTER (screenshot WrongTitlePosition.JPG).
3. Comment the 11th line in the test: // setLaF(LAF.NIMBUS);
4. Run the test again and note that the title position is correct (screenshot ProperTitlePosition.JPG).

More specifically:
If a Look and Feel sets the "TitledBorder.position" UI property and if an application uses this L&F at first and then changes it to another L&F that doesn't set the property, titled border position is turned out wrong. It becomes the same as the default position of the first L&F instead of the default position of the second one.
Posted Date : 2008-04-30 16:36:21.0
Work Around
There are several workarounds:
1. Call setTitlePosition() for every titled border.
2. Define "TitledBorder.position" UI property.
3. Don't switch Nimbus to other Look and Feels.
Evaluation
The bug is caused by the fix for 6595814.

The problem is in the TitledBorder.getTitlePosition() method. If the title position is DEFAULT_POSITION and if the current L&F defined "TitledBorder.position" UI property, the method replaces the current position by UI property's value. The method "forgets" that the position was default.

A solution can be to remember about DEFAULT_POSITION and track changes of current L&F.
Posted Date : 2008-04-30 16:38:47.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang