Setting JTextField width within S1 Studio GUI

Hello,

I'm reasonably new to Sun One Studio, but not to J2SE. I'm using the GUI editting tools to build my Swing applet in the hopes that it would be faster than typing all of those GridBagLayout constraints by hand.

If I were declaring my components manually, this would not be difficult. However, because I used the GUI I can't seem to find a way to limit the width of my JTextFields. For example, I have a component "customer name" that I want to limit to 25 characters. If done manually, the syntax would be something likeJTextField customerName = new JTextField(25);.

There's got to be a way to do this - I can't believe I'd have to leave customer name unlimited.

Please forgive my naivete regarding this IDE and give me a hand. By the way, other than the tutorial, which teaches you how to build a servlet, and the getting started guide, which teaches you how to install the IDE, are there books out there on how to use Sun One Studio version 4 update 1?

[1012 byte] By [CharlesKuehn] at [2007-11-25 10:05:20]
# 1

Hi ,

Right the JTextField and set its column property to 25.

If you look at the code then, you will find the following property set:

jTextField1 = new javax.swing.JTextField();

jTextField1.setColumns(25);

which is equilvalent to jTextField1 = new javax.swing.JTextField(25);

Get back if you issues.

-Amol

Amol desai at 2007-7-1 20:10:55 > top of Java-index,Development Tools,Java Tools...
# 2

Thanks, that did the trick.

Since I've got you on the line, can you tell me the best way to pass parameters to a Swing applet using the IDE? I'm using the <param> tag in my HTML. I've been trying to find the correct way to invoke the getParameter() method within the IDE.

I've been trying to modify the text property of the JTextField by including the call in user code: getParameter("dvdpackage"). It keeps giving me a null pointer exception.

The HTML tag is valid, and the string in the method call matches the spelling (and case) of the Name=attribute in the PARAM tag. Any suggestions on syntax or technique?

Thanks again

Charles Kuehn at 2007-7-1 20:10:55 > top of Java-index,Development Tools,Java Tools...