How can I access and use text from Feature InfoTool dialog. I'm working with JMapFrame. I found this snippet:

         InfoTool tool = new InfoTool() {
         @Override
         public void onReporterUpdated() {
             String text = getTextReporterConnection().getText();
             System.out.println(text);
         }
     };

but I don't see how to link this to my JMapFrame. So basically I don't know how to get InfoTool from JMapFrame.

link|improve this question
feedback

1 Answer

Instead of writing out the text value save it to a field in your class and use it like any other value.

String infoText = ""; 
InfoTool tool = new InfoTool() {
     @Override
     public void onReporterUpdated() {
         infoText = getTextReporterConnection().getText();

     }
 };
link|improve this answer
Really don't get your answer. syso is out there because i wanted to see whether i'll get some text. Of course i know how to use class fields and how to deal with string. The problem is that this event won't happen, onReportUpdated is never triggered. I guess i need to find a way to somehow link JMapFrame with InfoTool but i don't know how. Instantiated like this InfoTool doesn't have anything to do with user's click on the feature info button which resides on the JMapFrame's toolbar. – ilija Feb 10 at 20:10
I think you need to edit your question to make it clearer then, – iant Feb 12 at 13:18
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.