java - generic array with wildcard cause error -


I wanted to create with JComboBox type string, but it is in an array, so I used wildcard for array And string for single elements:

  JComboBox & lt ;? & Gt; [] Combos = new JComboBox & lt ;? & Gt; [10]; ... cobas [i] = new jcbox box & lt; String & gt; (); DefaultComboBoxModels with  

same:

  DefaultComboBoxModel  
  ... combo [i] .setModel (combo model [i]);  

Now the compiler returns the error (Capture # 13-of? # 14-Not applicable to capture?). One could expect that the single elements are set on the string and everything is fine. What is it about, how to deal with it? (Except for doing this raw)

Java needs to be ensured that the model and combo are the same Are of type. On the given example, once the type went away after extinction, there is no way to do this.

You can see the model & lt; Integer & gt; to combo & lt; String & gt; can be set.


Comments

Popular posts from this blog

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

c# - Process.Kill() returns access denied -

c# - Using the generic type 'System.Collections.Generic.List<T>' requires 1 type arguments -