title: How to align text position for two different components?
body: <p>I am trying to align the position of text within a JTextArea and a JButton, but with everything I tried, either nothing happens, or the alignment is still slightly off.</p>
  
  <p><strong>Here is what is looks like:</strong>
  <a href="https://i.stack.imgur.com/xLBOH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xLBOH.png" alt="enter image description here"></a>
  (You can see with the highlighted option that the JButton (center) is slightly lower than the two JTextAreas on either side.)</p>
  
  <p><strong>Here is some code:</strong></p>
  
  <pre><code>                categoryFile[i][j] = tempButton;
                  categoryFile[i][j].setBackground(Color.white);
                  categoryFile[i][j].setForeground(Color.black);
                  categoryFile[i][j].setOpaque(true);
                  categoryFile[i][j].setFocusable(false);
                  categoryFile[i][j].setBorderPainted(false);;
                  categoryFile[i][j].setVerticalAlignment(SwingConstants.TOP);
                  categoryFile[i][j].setPreferredSize(new Dimension(500,10));
                  categoryFile[i][j].addActionListener(new ActionListener() {
                      @Override
                      public void actionPerformed(ActionEvent e) {
                          openPDFWithOptions(filePath,fileName);
                      }
                  });
  
                  JPanel listRow = new JPanel();
                  listRow.setBackground(Color.white);
                  listRow.setLayout(new BorderLayout());
                  listRow.setPreferredSize(new Dimension(800, 40));
  
                  JTextArea category = new JTextArea(fileElements[0]); 
                  category.setEditable(false);
                  JTextArea parent = new JTextArea(fileElements[1]);
                  parent.setEditable(false);
  
                  listRow.add(parent,BorderLayout.WEST);
                  listRow.add(categoryFile[i][j],BorderLayout.CENTER);
                  listRow.add(category,BorderLayout.EAST);
  
                  categoryLists[i].add(listRow,c);
  </code></pre>
  
  <p>Right now I am using <code>categoryFile[i][j].setVerticalAlignment(SwingConstants.TOP)</code> to change the position of the JButton, which ALMOST works. I've also tried changing the vertical alignment of the JTextAreas, but nothing changed.</p>
  
  <p><em>How can I align the text within these components?</em></p>