[Scilab-Dev] Problem while solving Bug#14709

Clément David clement.david at scilab-enterprises.com
Fri Feb 24 08:51:09 CET 2017


Hi Nikhil,

> I tried to overload the setText method in ScilabSpecialTextUtilities so that SwingScilabListBox
> type variable could be passed to it but this also resulted in the same error. 
>    I think that the compatibility error is because SwingScilabListBox is not a part of the
> hierarchy of JComponent class.
> 
> [javac]
> /home/nikhil/scilab_master/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/Swing
> ScilabListBox.java:112: error: incompatible types: <anonymous ListCellRenderer> cannot be
> converted to JComponent
> 
>    Am I proceeding in the right direction or am I doing something wrong? Is there any other way to
> do this?

Yep you find the more complex part of Scilab GUI, Scilab components (within the bridge package) are
not directly mapped to the Java ones but instead has an indirection (using the composition pattern)
to them. For exemple :

SwingScilabListBox class as an associated JList class stored in the 'list' field. If you want the
rendering of an item of the list, take a look at SwingScilabListBox.java line 107 where JList
default renderer is changed to a Scilab specific one.

Thanks for you involvement, do not hesitate to ask questions,

--
Clément



More information about the dev mailing list