title: Adding a JButton to a JTextPane
body: <p>I'm having problems trying to add a JButton to a JTextPane with a String. So what I am trying to do is to add each String in a for loop and then add ad JButton after that added String. 
  The code below is what I am trying to accomplish. </p>
  
  <pre><code>ArrayLst&lt;String&gt; data = new ArrayList();
  data.add("Data here");
  data.add("Data here 2");
  data.add("Data here 3");
  data.add("Data here 4");
  
  Container cp = getContentPane();
  
  JTextPane pane = new JTextPane();
  SimpleAttributeSet set = new SimpleAttributeSet();
  StyleConstants.setBold(set, true);
  pane.setBackground(Color.BLUE);
  pane.setEditable(false);
  
  Document doc = pane.getStyledDocument();
  
  for(int i=0; i&lt;data.size(); i++)
  {
      doc.insertString(doc.getLength(), data.get(i)+ "\n", set);
      pane.insertComponent(new JButton("View Info"));
  }
  </code></pre>
  
  <p>Can anyone tell me how I can add a JButton to each of the Strings on the same line?</p>
  
  <p>Thanks very much appreciated</p>