Purpose
Here is a Java Bean that allows to manage an "auto completion" Swing JComboBox.

The Java code
CBAutoCompletion.java ComboBoxCompletion.java
The implementation class of the Bean Item
oracle.forms.fd.ComboBoxCompletion
The methods you can set
Init
the ComboBox values
-- Single value list --
Get_Custom_Property('BLOCK.ITEM',1,'INIT','value[,value[,...]]');
e.g.:
-- initialise the ComboBox values --
Set_Custom_Property('BL.BEAN',1,'INIT','Ester,Jordi,Jordina,Jorge,Sergi');
-- Twin value list (code+value) --
Get_Custom_Property('BLOCK.ITEM',1,'INIT_TWIN','code,value[,code,value[,...]]');
code(stored value) is provided, then after value (displayed)
e.g.:
-- initialise the ComboBox values --
Set_Custom_Property('BL.BEAN',1,'INIT_TWIN','v1,Ester,v2,Jordi,v3,Jordina,v4,Jorge,v5,Sergi');
This method must be the first called.
If you need to incorporate NULL values in the list, use the equivalent INIT_NULL and INIT_TWIN_NULL methods.
To set the focus on the NULL value, use the SELECT_INDEX,'1' or SELECT_CODE,''
methods.
Set the Font
font_weight could be one of the following:
P : Plain
B : Bold
I : Italic
BI : Bold+Italic
e.g.:
-- set the font --
Set_Custom_Property('BL.BEAN',1,'SET_FONT','Arial,B,12');
e.g.:
-- disable the ComboBox --
Set_Custom_Property('BL.BEAN',1,'SET_ENABLED,'false');
e.g.:
-- hide the ComboBox --
Set_Custom_Property('BL.BEAN',1,'SET_VISIBLE,'false');
Set the starting index (by position)
Get_Custom_Property('BLOCK.ITEM',1,'SELECT_INDEX','index_num');
e.g.:
-- set focus on the 3rd option --
Set_Custom_Property('BL.BEAN',1,'SELECT_INDEX','3');
Set the starting index (by code)
Get_Custom_Property('BLOCK.ITEM',1,'SELECT_CODE','code');
e.g.:
-- set focus on the 3rd option --
Set_Custom_Property('BL.BEAN',1,'SELECT_CODE','v2');
Set the starting index (by value) twin value list only
Get_Custom_Property('BLOCK.ITEM',1,'SELECT_VALUE','value);
e.g.:
-- set focus on the 3rd option --
Set_Custom_Property('BL.BEAN',1,'SELECT_VALUE','Jordi');
The event raised by the bean
Each time the end user change the current value of the combobox, a message is send to Forms.
You can get this message in the When-Custom-Item-Event trigger of the Bean Item:
The index number is read from the SELECTION_INDEX list parameter
The code is read from the SELECTION_CODE list parameter
The value is read from the SELECTION_VALUE list parameter
DECLARE
eventName varchar2(30) := :system.custom_item_event;
eventValues ParamList;
eventValueType number;
LC$Index varchar2(10);
LC$Code varchar2(1000);
LC$Value varchar2(1000);
BEGIN
IF (eventName='SELECTION_CHANGED') THEN
eventValues := get_parameter_list(:system.custom_item_event_parameters);
get_parameter_attr(eventValues,'SELECTION_INDEX',eventValueType, LC$Index);
get_parameter_attr(eventValues,'SELECTION_Code',eventValueType, LC$Code);
get_parameter_attr(eventValues,'SELECTION_VALUE',eventValueType, LC$Value);
-- display the current selction --
:BL.SELECT := '[' || LC$Index || '] (' || LC$Code || ') ' || LC$Value ;
END IF;
END;