0

Any method available to place the JTextArea to the right of the JPanel?

1
  • You need to be more specific. Maybe if you posted some of your code it would help or a screenshot of your application Commented Jul 1, 2009 at 10:30

3 Answers 3

1

Do you mean in the right hand side within the JPanel?

If so, you could construct the JPanel with a BorderLayout as its layout manager, then add the JTextArea with

panel.add(textArea, BorderLayout.EAST);

It's possible that BorderLayout isn't what you want though, depending on the right of your controls. There are many options available. I suggest you read a layout tutorial for more details.

If that's not what you mean, please clarify the question.

0
1

This depends on the LayoutManager that your JPanel uses, not the JTextArea itself. Unless you specify a LayoutManager when creating your JPanel, it will be using FlowLayout.

0

Try adding a spacer component to the JPanel first which will push the text area to the right. The code to create such a component is: Box.createHorizontalGlue();