/*Default value for this property is "ORACLE" but It can be: "MS-ACCESS", "SQL-SERVER", "MYSQL",....etc.*/
String database = "ORACLE";
How can I create a comboBox editor for this property to accept one of above string values for database so that I can use it using Beanbox provided by Netbeans or any other IDE ?
If we need to use PropertyEditor class for this purpose then plese give me an example...
Thanks In Advance
Welcome to the Ranch!
There is a class PropertyEditorSupport present in the java.beans package. You need to extend it and override the getCustomEditor() method to return your own component (also I think the supportsCustomEditor() method must also be overridden). you should start from there.
Ranganathan Kaliyur Mannar wrote:Hi Gajesh,
Welcome to the Ranch!
There is a class PropertyEditorSupport present in the java.beans package. You need to extend it and override the getCustomEditor() method to return your own component (also I think the supportsCustomEditor() method must also be overridden). You should start from there.
Thank you Mr. Ranganathan Kaliyur Mannar for your reply..
I created a class DatabaseEditor as suggested by you...
Other source codes are attached herewith: Due to limitation of coderanch, I use .jpg extension with actual file, please remove .jpg extension to use these attachment files
But its not working, please check my code & tell me what & where is actual problem?
Purpose of my java bean component is : fill list using "connection", "tableName", "keyFieldName" & "valueFieldName" property & also generate condition that can be used in another sql query according to user's selection. You can also import this code into your test/sample netbean project for checking purpose.
I register this property using following fragment of code:-
java.lang.IllegalArgumentException: argument type mismatch
Please check my DatabaseEditor class & tell me why this error is occurred if you know about that.
Any ways, my main problem is solved & its my duty to submit solution here for closing this Thread.
Modification in PnlForQuery.java
Modification in PnlForQueryBeanInfo.java
and its successfully working.[/code]
Advantage of This Thread:-How to use combo box as a Property Editor? and conclusion is that we do not require to extend PropertyEditorSupport for selecting one value from multiple choice. Instead we set the multiple choice values to enumerationValues attribute of PropertyDescriptor's object.
Thanks for viewing this Thread...
Glad it was of help to you.
And thanks for posting back a better solution.