title: How do I use Listener to pass a string to another class
body: <p>Am am writing a simple browser, which has two classes, SimpleBrowser and MyTabbedPane.
   SimpleBrowser has some Gui components such as JButton and TextField, while MyTabbedPane has tabbedpane which has JEditorPane.
  I want to pass the Search string entered in SimpleBrowser JTextField into JEditorPane which is in MyTabbedPane
  i don't how to use getter and setter
  Here some of my code</p>
  
  <pre><code> package com.mysimplebrowser;  
  
  import java.awt.event.ActionEvent;  
  import java.awt.event.ActionListener;  
  import javax.swing.*;  
  
   class SimpleBrowser extends JFrame{  
      private JTextField myField;  
      private JButton myButton;    
      private JPanel myPanel;  
      private MyTabbedPane myTabbedPane;  
  
      public SimpleBrowser(){  
          setSize(400, 400);  
  
          myPanel = new JPanel(); // panel  
          myField = new JTextField();  
          myPanel.add(myField);  
  
          myButton = new JButton("Search");  
          myButton.addActionListener(new ActionListener() {  
              public void actionPerformed(ActionEvent e) {  
                  // how do i go about here  
                }  
          });  
          myPanel.add(myButton);  
          // i have left out some code  
  
          add(myPanel);  
          setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);  
      }  
  
      class MyTabbedPane extends JTabbedPane{  
          private String searchWord;  
          private JEditorPane myEditorPane;  
  
          public MyTabbedPane(){  
              // i have left some code out  
              myEditorPane = new JEditorPane();  
              // i have left out some code for the HTML kit  
  
              // i want later to add google Ajax api code or the depreciated  
              // google SOAP jar apis but am stuck on how to pass the String  
              // entered in the class SimpleBrowser JTextField into  
              // MyTabbedPane private String SearchWord  
  
              String myUrl = "http://localhost/Good" + searchWord + "html";  
              myEditorPane.setPage(myUrl); // left out some try ... catch code  
          }  
      }  
  
      public static void main(String[] args){  
          SwingUtilities.invokeLater(new Runnable() {  
              public void run() {  
                  new SimpleBrowser().setVisible(true);  
              }  
          });  
      }  
  }  
  </code></pre>