Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Netbeans form editor and JFormattedTextField

Reply
Thread Tools

Netbeans form editor and JFormattedTextField

 
 
Mack Attack
Guest
Posts: n/a
 
      09-15-2003
The Netbeans form editor uses parameterless constructors for all components.
I don't think there is any way around this.

I want to use a JFormattedTextField and have it set to use a specific format.
If I wasn't using the form editor I would do something like this:

NumberFormat percentFormat = NumberFormat.getNumberInstance();
percentFormat.setMinimumFractionDigits(3);
myFormattedTextField = new JFormattedTextField( percentFormat );

How can I do the same thing with the JFormattedTextField created by the form?
I've looked at setFormatter and setFormatterFactory but they have me completely
confused.

Thanks
 
Reply With Quote
 
 
 
 
Christophe Vanfleteren
Guest
Posts: n/a
 
      09-15-2003
Mack Attack wrote:

> The Netbeans form editor uses parameterless constructors for all
> components. I don't think there is any way around this.
>
> I want to use a JFormattedTextField and have it set to use a specific
> format. If I wasn't using the form editor I would do something like this:
>
> NumberFormat percentFormat = NumberFormat.getNumberInstance();
> percentFormat.setMinimumFractionDigits(3);
> myFormattedTextField = new JFormattedTextField( percentFormat );
>
> How can I do the same thing with the JFormattedTextField created by the
> form? I've looked at setFormatter and setFormatterFactory but they have me
> completely confused.
>
> Thanks


Select the JFormattedTextField in the gui designer.
Then go to the "code generation" tab of the properties panel.
Select the "custom creation code" field.
Type "new JFormattedTextField( percentFormat );" (without the quotes
ofcourse) in the field.

You can also set the Numberformat part in the
"pre-creation code" field.

--
mvg,
Christophe Vanfleteren
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NetBeans form editor - palette empty I82Much Java 0 05-05-2009 09:38 PM
JFormattedTextField and nullFormatter Francois Java 0 11-08-2006 09:13 PM
ANN: New low-cost XML Editor, XSLT Editor, XSLT Debugger, DTD/Schema Editor Stylus Studio Java 0 08-03-2004 03:53 PM
InputVerifier and JFormattedTextField Problem :( Steve Webb Java 4 04-29-2004 08:12 PM



Advertisments