Hi,

I am new to java and am facing this problem. I have to use a TextEditor to display a list of customers. The JAR for that Texteditor which i have to use is available at (http://code.google.com/p/jtexteditor/downloads/list). Below is my class in which i am trying to use it. I am calling this code (view) from other class(controller) and the compiler says that i have to specify an argument while initializing an object of this class. I have no idea what to give in as an argument ?

import java.lang.reflect.Constructor;

public class ShowListDialogUI<TextEditor> {

    private final Constructor<? extends TextEditor> ctor;

      private TextEditor field;

      ShowListDialogUI(Class<? extends TextEditor> impl) throws NoSuchMethodException, SecurityException {
        this.ctor = impl.getConstructor();
      }

      public void myMethod() throws Exception
      {
        field = ctor.newInstance();
      }
}

I don't understand why you are getting into Java reflection to use this jar. Reflection would count as as "advanced" topic, asnd most programs will never use it. You should be able just to call a TextEditor constructor without using reflection. There';s an example of that in the source code, which you can download from the same site as the jar itself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.