NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
Ian Carter Posted via mailing list.
|
Posted: Thu Jul 10, 2008 10:06 am Post subject: beans binding convertion |
|
|
Is this yet another case of the NetBeans documentation leading us up the
garden path?
I want to bind a jTextField to a Jbutton such that when there is no text in
the jTextField, the Jbutton is disabled. I've not done this before, so I'm
using the NetBeans help as a guide. So I proceeded to set a a binding in the
prescribed manner in the Properties window.
I could not get it to work, try as I might! The help clearly states that...
"Below is a list of conversions for which you do not need to provide a
converter:
BigDecimal to String, String to BigDecimal
BigInteger to String, String to BigInteger
Boolean to String, String to Boolean <<<<< this is what I want
Byte to String, String to Byte
Char to String, String to Char
Double to String, String to Double
Float to String, String to Float
Int to String, String to Int
Long to String, String to BigDecimal
Short to String, String to Short
Int to Boolean, Boolean to Int"
So, nothing is happening by default, so let me see if I can tell it the
converter I want to use.
Using the Advanced tab, the Type Conversion field is a text field, not a
combo-box for one thing - Why?. So I click the elipsis button and select
"Component Chooser". Guess what? I am told: "Custom editing of this
component is not supported"!
By this time I am getting really ticked off, going round in circles.
Eventually I have to write the damn Converter myself...
private class TextFieldToButtonConv extends
org.jdesktop.beansbinding.Converter<String, Boolean> {
public Boolean convertForward(String value) {
return value.length() > 0;
}
// not used
public String convertReverse(Boolean value) {
return "";
}
}
If the help had told me I needed to do this, I would have gone ahead and
done without banging my head against the wall 16 times!
When is the documentation going to be correct? In version 12?
Ian |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|