tags:

views:

212

answers:

3

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

A: 

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();

Richie_W
+1  A: 

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.

Jon Skeet
yep!! tats wat i meant..
+1  A: 

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.

ninesided