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.
Using VWP with Netbeans 5.5 or Netbeans 6 M10 I can't correctly arrange the text field components. Because the size of the text field that I view in Netbeans it's very different of the size of the component when it's rendered to the browser. For complete info look at http://www.nabble.com/Text-field-size-rendering-not-displays-correctly-in-browser-using-VWP-tf4230458.html#a12035314
Yes it seems there size based on specified columns doesn't seem to be correct. You can try to see that (by default column size is 20), and if you put 20 chars into the text field (e.g. "12345678901234567890", you can see that the size shown is actually some columns bigger. Investigating.
It seems the problem is with the swing component (text field in this case), which computes the width, that it adds some gap after the specified number comlumns, so the actual width is larger than the number of specified columns.
So I found the issue, the width in swing is computed based on the number of columns, and it is interpreted the way that one column width is equal the width of 'm' character of used font. I.e. when in swing you have textfield which you specify 20 columns. The width will be the same like with of this text: "mmmmmmmmmmmmmmmmmmmm" the problem is when used different characters there appears the gap, e.g.: "12345678901234567890" Note: you can see the difference when non-monospaced font is used. When comparing the browser, it seems that it calculates the width of textfield based on the columns, using different character than 'm' (you can try to put that above text, and you'll it won't be fully visible in firefox with textfield with 20 columns. We needs to compute the width of textfield similar way the browser does. First we need to find out (hopefully not guess?) how browser does that.
I didn't find any algorithm. It seems it is not specified by W3C, and each browser implements it on its own. Because of this I'll try to adjust it a bit, so the difference is not that big.
Fixed. Now it will be closer to the column widths used by the browsers (compared to Firefox). Note: Each browser has each own algorithm, so all of them (at least) slightly differ as well. Checking in visualweb/designer/src/org/netbeans/modules/visualweb/css2/FormComponentBox.java; /cvs/visualweb/designer/src/org/netbeans/modules/visualweb/css2/FormComponentBox.java,v <-- FormComponentBox.java new revision: 1.10; previous revision: 1.9 done Checking in visualweb/designer/src/org/netbeans/modules/visualweb/designer/FormComponentEditor.java; /cvs/visualweb/designer/src/org/netbeans/modules/visualweb/designer/FormComponentEditor.java,v <-- FormComponentEditor.java new revision: 1.21; previous revision: 1.20 done
My little testings showed that the two major browsers Firefox 2.0 and IE7 display practically equal (look at the images of nabble link). I think that what more significantly change the size of a field is increasing the text size in the browser. I haven't been able to test your patch although I think that it will be perfect for me. But possibly wouldn't be a bad idea to leave a parameter in advanced config named VWP_column_size_factor. That way people people with target their applications to other browsers or to other text sizes won't have any problems.
Marking this as verified in: NetBeans IDE Dev (Build 200708161200) Java: 1.5.0_12; Java HotSpot(TM) Client VM 1.5.0_12- b04 System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb) Lujop, You can download a daily build (Java EE package) to also verify: http://bits.netbeans.org/download/6.0/nightly/200708161200/
Fixed also password field. Checking in visualweb/designer/src/org/netbeans/modules/visualweb/css2/FormComponentBox.java; /cvs/visualweb/designer/src/org/netbeans/modules/visualweb/css2/FormComponentBox.java,v <-- FormComponentBox.java new revision: 1.13; previous revision: 1.12 done
*** Issue 116079 has been marked as a duplicate of this issue. ***