gt:                 output += fact + "\n";
context: /*
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */
  package org.clipsmonitor.gui;
  
  import java.util.ArrayList;
  import java.util.Observable;
  import java.util.Observer;
  import javax.swing.event.DocumentEvent;
  import javax.swing.event.DocumentListener;
  import org.clipsmonitor.clips.ClipsConsole;
  import org.clipsmonitor.core.MonitorModel;
  import org.clipsmonitor.monitor2015.AssistedLivingModel;
  import org.netbeans.api.settings.ConvertAsProperties;
  import org.openide.awt.ActionID;
  import org.openide.awt.ActionReference;
  import org.openide.windows.TopComponent;
  import org.openide.util.NbBundle.Messages;
  
  /**
   * Top component which displays something.
   */
  @ConvertAsProperties(
          dtd = "-//org.clipsmonitor.gui//Facts//EN",
          autostore = false
  )
  @TopComponent.Description(
          preferredID = "FactsTopComponent",
          //iconBase="SET/PATH/TO/ICON/HERE", 
          persistenceType = TopComponent.PERSISTENCE_ALWAYS
  )
  @TopComponent.Registration(mode = "facts", openAtStartup = true)
  @ActionID(category = "Window", id = "org.clipsmonitor.gui.FactsTopComponent")
  @ActionReference(path = "Menu/Window" /*, position = 333 */)
  @TopComponent.OpenActionRegistration(
          displayName = "#CTL_FactsAction",
          preferredID = "FactsTopComponent"
  )
  @Messages({
      "CTL_FactsAction=Facts",
      "CTL_FactsTopComponent=Facts Window",
      "HINT_FactsTopComponent=This is a Facts window"
  })
  public final class FactsTopComponent extends TopComponent implements Observer {
      private MonitorModel model;
      private ClipsConsole console;
      private String filter;
      private String factList;
      private String focus;
      
      public FactsTopComponent() {
          initComponents();
          setName(Bundle.CTL_FactsTopComponent());
          setToolTipText(Bundle.HINT_FactsTopComponent());
          init();
      }
      
      private void init(){
          model = AssistedLivingModel.getInstance();
          console = ClipsConsole.getInstance();
          model.addObserver(this);
          filter ="";
          factList = "";
          focus = "";
          
          // Listen for changes in the text
          this.SearchText.getDocument().addDocumentListener(new DocumentListener() {
              @Override
              public void insertUpdate(DocumentEvent e) {
                  updateSearch();
              }
  
              @Override
              public void removeUpdate(DocumentEvent e) {
                  updateSearch();
              }
  
              @Override
              public void changedUpdate(DocumentEvent e) {
                  updateSearch();
              }
              
              private void updateSearch(){
                  String search = SearchText.getText();
                  if(!search.equals(filter)){
                      filter = search;
                      updateText();
                  }
              }
          });
      }
      
      private void clear(){
          model = null;
          console = null;
          factList = "";
          focus = "";
          this.jTextPane1.setText(factList);
          this.SearchText.setText(focus);
      }
  
      /**
       * This method is called from within the constructor to initialize the form.
       * WARNING: Do NOT modify this code. The content of this method is always
       * regenerated by the Form Editor.
       */
      // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
      private void initComponents() {
  
          jPanel1 = new javax.swing.JPanel();
          SearchText = new javax.swing.JTextField();
          jScrollPane1 = new javax.swing.JScrollPane();
          jTextPane1 = new javax.swing.JTextPane();
          jLabel1 = new javax.swing.JLabel();
  
          SearchText.setToolTipText(org.openide.util.NbBundle.getMessage(FactsTopComponent.class, "FactsTopComponent.SearchText.toolTipText")); // NOI18N
          SearchText.addKeyListener(new java.awt.event.KeyAdapter() {
              public void keyTyped(java.awt.event.KeyEvent evt) {
                  SearchTextKeyTyped(evt);
              }
          });
  
          jScrollPane1.setFocusable(false);
  
          jTextPane1.setEditable(false);
          jScrollPane1.setViewportView(jTextPane1);
  
          org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FactsTopComponent.class, "FactsTopComponent.jLabel1.text")); // NOI18N
  
          javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
          jPanel1.setLayout(jPanel1Layout);
          jPanel1Layout.setHorizontalGroup(
              jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addComponent(jScrollPane1)
              .addGroup(jPanel1Layout.createSequentialGroup()
                  .addComponent(SearchText, javax.swing.GroupLayout.DEFAULT_SIZE, 316, Short.MAX_VALUE)
                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                  .addComponent(jLabel1)
                  .addContainerGap())
          );
          jPanel1Layout.setVerticalGroup(
              jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                      .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addComponent(SearchText, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                  .addGap(0, 0, 0)
                  .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE))
          );
  
          javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
          this.setLayout(layout);
          layout.setHorizontalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
          );
          layout.setVerticalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
          );
      }// </editor-fold>//GEN-END:initComponents
  
      private void SearchTextKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_SearchTextKeyTyped
      }//GEN-LAST:event_SearchTextKeyTyped
  
      // Variables declaration - do not modify//GEN-BEGIN:variables
      private javax.swing.JTextField SearchText;
      private javax.swing.JLabel jLabel1;
      private javax.swing.JPanel jPanel1;
      private javax.swing.JScrollPane jScrollPane1;
      private javax.swing.JTextPane jTextPane1;
      // End of variables declaration//GEN-END:variables
      @Override
      public void componentOpened() {
          // TODO add custom code on component opening
      }
  
      @Override
      public void componentClosed() {
          // TODO add custom code on component closing
      }
  
      void writeProperties(java.util.Properties p) {
          // better to version settings since initial version as advocated at
          // http://wiki.apidesign.org/wiki/PropertyFiles
          p.setProperty("version", "1.0");
          // TODO store your settings
      }
  
      void readProperties(java.util.Properties p) {
          String version = p.getProperty("version");
          // TODO read your settings according to their version
      }
  
      @Override
      public void update(Observable o, Object arg) {
          if(arg == "actionDone" || arg == "cmd" || arg == "disposeDone" || arg == "setupDone"){
              this.updateFacts();
          }
          else if(arg == "clearApp"){
              this.clear();
          }
          else if(arg == "startApp"){
              this.init();
          }
      }
      
      private void updateFacts(){
          factList = model.getFactList();
          focus = model.getFocus();
          updateText();
      }
      
      private void updateText(){
          this.jTextPane1.setText(this.getFactList(this.filter, factList) + "(module " + focus + ")");
          this.jTextPane1.setCaretPosition(jTextPane1.getText().length());
      }
      
      
      private String getFactList(String query, String factList)
      {
          if(query.equals("")){
              return factList;
          }
          String[] facts = factList.split("[\r\n]+");
          String output = "";
          for(String fact: facts){
              if(fact.contains(query)){
  