Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Aligning component from Right to Left  RSS feed

 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
I need to align components in the order of Right to Left alignment.Any suggestions which layout manager will be best suited for this scenario.
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

you could try FlowLayout with ComponentOrientation.RIGHT_TO_LEFT layout orientation. Hope this works for you as expected.

Marco
[ May 07, 2008: Message edited by: Marco Ehrentreich ]
 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marco Ehrentreich:
Hi,

you could try FlowLayout with ComponentOrientation.RIGHT_TO_LEFT layout orientation. Hope this works for you as expected.



Thanks Marco for your suggestion,

It didn't work out as intended.I will explain my problem in more detail

I already have a JPanel with BorderLayout consider it as MainPanel.Now over my MainPanel i added one more JPanel with FlowLayout consider it as SubPanel.

Now the view is my MainPanel contains SubPanel.

Now i need to insert some Components like JLabel,JButton onto my SubPanel in Right to Left alignment.

But what i am getting is the last component i insert in my SubPanel is only visible in my MainPanel.How to overcome this one?
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To get better help sooner, post a SSCCE that clearly demonstrates your problem.
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you have a problem with the hierarchical structuring of your containers and layout managers. You have to use containers like panels to add more than one component. Then you have to layout these containers with a layout manager. There's definitely something wrong if you can only add ONE component because then a layout manager wouldn't make any sense

Perhaps Sun's Java Tutorial may help you to get it right.

Marco
 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys,

I resolved it by placing all the components on a single JPanel and it worked well.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!