Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
add comment

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();

     }
 };
share|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 '12 at 20:10
    
I think you need to edit your question to make it clearer then, –  iant Feb 12 '12 at 13:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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