Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-29-2008, 03:49 PM
Member
 
Join Date: Apr 2008
Posts: 5
nanou is on a distinguished road
[SOLVED] Alignment in GroupLayout
Hi,

I'm using a GroupLayout. I have some problems to align components.
For example in my first panel:
- label nammed "Ignorer la première ligne" with radio button
- it's the same whith the label called "Ignorer la dernière ligne" and its radio button

In the third panel:
- I think that gaps in this panel are bigger than in the others because of the placement of checkboxes. I would place them a little more up (I tried with LEADING alignment but may be I use it not correctly).

In order to understand my problem, I give you a file in attachment wich represent my graphic user interface.

Code of my first panel:
Code:
layout.setHorizontalGroup( layout.createSequentialGroup() .addGap(10) .addGroup(layout.createParallelGroup() .addComponent(lbl_traitement) .addComponent(labelSave) .addComponent(labelSep) .addComponent(ligne_1er) .addComponent(ligne_der) .addComponent(label_ligne)) .addGap(10) .addGroup(layout.createParallelGroup() .addComponent(traitement) .addComponent(fichierSave) .addComponent(sep) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addComponent(br_oui_bg1)) .addGroup(layout.createParallelGroup() .addComponent(br_non_bg1))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addComponent(br_oui_bg2)) .addGroup(layout.createParallelGroup() .addComponent(br_non_bg2))) .addComponent(nb_ligne)) .addGap(10) .addGroup(layout.createParallelGroup() .addComponent(boutonParcourir)) .addGap(10) ); layout.setVerticalGroup( layout.createSequentialGroup() .addGap(5) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lbl_traitement) .addComponent(traitement)) .addGap(5) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(labelSave) .addComponent(fichierSave) .addComponent(boutonParcourir)) .addGap(5) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(labelSep) .addComponent(sep)) .addGap(5) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(ligne_1er) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(br_oui_bg1) .addComponent(br_non_bg1)))) .addGap(5) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(ligne_der) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(br_oui_bg2) .addComponent(br_non_bg2)))) .addGap(5) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(label_ligne) .addComponent(nb_ligne)) .addGap(5) );
Code of my third panel:
Code:
layout.setHorizontalGroup( layout.createSequentialGroup() .addGap(10) .addGroup(layout.createParallelGroup() .addComponent(lbl_taxo) .addComponent(lbl_arrete) .addComponent(lbl_entite) .addComponent(lbl_perimetre)) .addGap(10) .addGroup(layout.createParallelGroup()//GroupLayout.Alignment.LEADING) .addComponent(col_a_affecter) .addComponent(combo_taxo) .addComponent(combo_arrete) .addComponent(combo_entite) .addComponent(combo_perimetre)) .addGap(10) .addGroup(layout.createParallelGroup()//GroupLayout.Alignment.LEADING) .addComponent(cb_taxo) .addComponent(cb_arrete) .addComponent(cb_entite) .addComponent(cb_perimetre)) .addGap(10) .addGroup(layout.createParallelGroup()//GroupLayout.Alignment.LEADING) .addComponent(this.col_a_preciser) .addComponent(combo_val_taxo) .addComponent(combo_val_arrete) .addComponent(combo_val_entite) .addComponent(combo_val_perimetre)) .addGap(10) ); layout.setVerticalGroup( layout.createSequentialGroup() .addGap(5) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(col_a_affecter) .addComponent(col_a_preciser)) .addGap(5) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lbl_taxo) .addComponent(combo_taxo) .addComponent(cb_taxo) .addComponent(combo_val_taxo)) .addGap(5) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lbl_arrete) .addComponent(combo_arrete) .addComponent(cb_arrete) .addComponent(combo_val_arrete)) .addGap(5) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lbl_entite) .addComponent(combo_entite) .addComponent(cb_entite) .addComponent(combo_val_entite)) .addGap(5) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lbl_perimetre) .addComponent(combo_perimetre) .addComponent(cb_perimetre) .addComponent(combo_val_perimetre)) .addGap(5) );
Moreover I want that the 3 panel have the same height.
I tried with this code, but it doesn't work:
Code:
this.pack(); int height = this.p_fichier.getHeight(); this.p_elements_obl.setSize(this.p_elements_obl.getWidth(), height); this.p_elements_fac.setSize(this.p_elements_fac.getWidth(), height); this.validate();
If you have any idea ???

Thanks in advance,
Regards.

Yannick
Attached Images
File Type: jpg dev.JPG (44.1 KB, 1 views)

Last edited by nanou : 04-29-2008 at 05:42 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-29-2008, 05:34 PM
Member
 
Join Date: Apr 2008
Posts: 5
nanou is on a distinguished road
My problem on the third panel is resolved : I resize checkbox and it works perfecly.

But I still get the problem with the alignment between a label and two radio buttons :
the baseline of my label is not the same baseline of the two radio buttons.

Please help...

Thanks.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-29-2008, 08:31 PM
Zosden's Avatar
Senior Member
 
Join Date: Apr 2008
Posts: 218
Zosden is on a distinguished road
Why do you use a program to make your GUI it makes your code unreadable. I know its easier, but is easier always the best way to do things, especially in a field such a computer science.
__________________
Definition of Impossible = making a good game in Java.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-30-2008, 10:29 AM
Member
 
Join Date: Apr 2008
Posts: 5
nanou is on a distinguished road
Hi,

Quote:
Why do you use a program to make your GUI...
Why do you say that? I write this code with my hand, not with a program. To my mind it's not so difficult to understand this code...

Regards
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-30-2008, 11:00 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 1,131
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
He says that, easy to work with a Java IDE. Yes rather working by hand, it is easy to work on a IDE pal. You have to make a minimal effort to do it.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Want to make your IDE the best?Vote Now
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 04-30-2008, 11:15 AM
Member
 
Join Date: Apr 2008
Posts: 5
nanou is on a distinguished road
Hi,

ok thanks.

I've found my error in 1st panel -> inside the verticalGroup

this code :
Code:
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(ligne_1er) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(br_oui_bg1) .addComponent(br_non_bg1)))) .addGap(5) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(ligne_der) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(br_oui_bg2) .addComponent(br_non_bg2))))
becomes
Code:
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(ligne_1er) .addComponent(br_oui_bg1) .addComponent(br_non_bg1)) .addGap(5) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(ligne_der) .addComponent(br_oui_bg2) .addComponent(br_non_bg2)) ...
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 04-30-2008, 11:19 AM
Member
 
Join Date: Apr 2008
Posts: 5
nanou is on a distinguished road
Hi,

how to say that my problem is solved?

Thanks
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 04-30-2008, 11:35 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 1,131
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
It's a nice work pal, make the correction by yourself. At the same time it's nice to see that you want to mark it as solved.

On top of the thread, you can find a link Thread Tools. Click it, and there you an see Mark this thread as solved. Just click on it and see what happened.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Want to make your IDE the best?Vote Now
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] alignment problem nanimtech JavaServer Pages (JSP) and JSTL 1 04-10-2008 02:23 PM
what layout to use for vertical alignment? dim_ath AWT / Swing 6 01-20-2008 06:28 PM
Alignment Issue... chanduseec JavaServer Faces 0 08-13-2007 02:04 PM
alignment of textfield in awt nitinborge5 New To Java 2 07-30-2007 12:16 PM


All times are GMT +3. The time now is 12:51 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org