This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 156242 - TitledBorder plain in NetBeans, bold when executed
Summary: TitledBorder plain in NetBeans, bold when executed
Status: RESOLVED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-03 16:45 UTC by rost
Modified: 2009-07-16 17:22 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Example picture showing the problem (11.34 KB, image/png)
2009-01-03 16:55 UTC, rost
Details
156242.jpg (154.59 KB, image/jpeg)
2009-01-08 09:38 UTC, Jiri Vagner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rost 2009-01-03 16:45:37 UTC
Whenever I create a TitledBorder in NetBeans it is showing a plain font in the designer and in design previews. But when
I actually execute my program, the TitledBorder is showing a bold font (tested with Kubuntu-8.04.1).
The problem I run into looks like Issue#22938, but this issue is VERIFIED FIXED?!
Comment 1 rost 2009-01-03 16:55:32 UTC
Created attachment 75420 [details]
Example picture showing the problem
Comment 2 Tomas Pavek 2009-01-05 16:40:15 UTC
Is this the only difference? Or are there more if you add more components? How does the form look if you invoke preview
on Metal look & feel (see context menu of JFrame node)?

It can be due to different look&feel NetBeans run on (compared to standalone java application). What is JDK version you use?
Comment 3 rost 2009-01-06 22:08:20 UTC
> Is this the only difference? Or are there more if you add more components?
Yes, it is the only difference I am aware of.

> How does the form look if you invoke preview on Metal look & feel (see context menu of JFrame node)?
It still shows the TitledBorder (wrongly) in a plain font.

> What is JDK version you use?
Here are some details from the Help->About dialog:

Product Version: NetBeans IDE 6.5 (Build 200811100614)
Java: 1.6.0_10; Java HotSpot(TM) Client VM 11.0-b15
System: Linux version 2.6.24-22-generic running on i386; ANSI_X3.4-1968; en_US (nb)
Userdir: /home/ronny/.netbeans/6.5
Comment 4 Jiri Vagner 2009-01-08 09:38:18 UTC
Created attachment 75575 [details]
156242.jpg
Comment 5 Jiri Vagner 2009-01-08 09:52:06 UTC
>> How does the form look if you invoke preview on Metal look & feel (see context menu of JFrame node)?
> It still shows the TitledBorder (wrongly) in a plain font.

Wrongly? Your metal preview contains title rendered in a plain font. I thought that this is correct.
Comment 6 Jiri Vagner 2009-01-08 10:08:31 UTC
Workaround: Set default font (Dialog 11 Plain) manually
  - open "Border customizer" dialog
  - open "Font" custom editor
  - set title font using "Custom code" instead of using "Default editor"
  - use code : new java.awt.Font("Dialog", java.awt.Font.PLAIN, 11)
Comment 7 Tomas Pavek 2009-01-08 17:18:22 UTC
So looks like a problem only with TitledBorder font on Metal Look and Feel. NetBeans changes the l&f defaults slightly 
(fonts, colors, etc). The GUI builder must revert these changes to be able to show the forms the way they should look 
by default in a plain java application. Seems there's some problem in case of the TitledBorder font - the NetBeans 
font is used instead of the real default. However, this does not affect functionality, only the appearance of the 
title on Metal L&F.
Comment 8 rost 2009-01-11 22:27:16 UTC
> Seems there's some problem in case of the TitledBorder font - the NetBeans font is used instead of the real default. 

Thank you for finding and explaining the reason of this bug.


> However, this does not affect functionality, only the appearance of the title on Metal L&F.

I just happened to get several times a rude surprise when I created a dialog, chose fonts and borders in the designer to
get a consistent look and feel but when actually running the program it looked completely different...
Comment 9 Jan Stola 2009-07-16 17:22:34 UTC
The sub-properties of border property were not initialized in GUI Builder's look and feel block. Unfortunately, there 
was one more problem with the TitledBorder itself. The TitledBorder doesn't remember default values of its properties - 
it everytime loads these values from UIDefaults. Hence, a simple initialization in our l&f block is not sufficient 
because it loads incorrect values from NetBeans IDE UIDefaults once we leave the l&f block. So, we have to push the 
default values back into TitledBorder. For example, we have to call border.setTitleFont(border.getTitleFont()) to force 
the border to remember its default value.

Modified files: http://hg.netbeans.org/cdev/rev/53dc51b4ff21