views:

147

answers:

3

when design

alt text

when run

alt text

when design and run in netbeans 6.5 they are the same, but int 6.7 and 6.8, as you see, they are different!

A: 

You might examine the generated code for a call to setUndecorated() in the top one.

trashgod
this is not a good idea, when i use setUndecorated(), there is an exption "IllegalComponentStateException", "The dialog is displayable."
Keating
Indeed, I thought maybe the top one was already using setUndecorated(); that's the apparent difference. The exception you mention is thrown by setContentPane() or setLayeredPane(). Any help from the debugger?
trashgod
i have not use setUndecorate(). And there isn't exception. I think when run the project, the font become fatter.
Keating
trashgod
A: 

Looks like your bottom component is JTextArea which is NOT set inside the scroll pane. Since the font is different in the second sample, last line of text wraps.

This can be mitigated in 2 different ways. Either set you JTextArea inside the scroll pane ( size of the scroll pane will not change and text area will scroll ) or set original font to your text area.

I'd suggest the first one.

eugener
The jTextArea is in a scroll pane. int 6.5 and 6.8, they have the same font--monospaced(the default font).
Keating
The font is clearly different. Your scroll pane then set to be resizable in your group layout - I want think you want that.
eugener
+1  A: 

The two images are each showing a different font. (Note the descender on the 'j' in "Java". In the first image it descends below the baseline. In the second it does not.)

In Java, "monospace" is a "virtual" font that is substituted at runtime with a fixed width font. Your development environment is resolving a different font than your execution environment.

Try explicitly setting the cont to "Courier New".

Devon_C_Miller