0

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();
      }
}
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by JamesCherrill
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.