Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Java GUI
Hi,
How do I make a GUI that look like this? I tried GridLayout but the size of Panel A and B is always equal. How do i make something NOT equal like 30px vs 200px ......Also, I want to hand coded method. No drag and drop.
------------------------------------------
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-            JPanel A(1000px x 30px)     -
-                                        -
------------------------------------------
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-            JPanel B(1000px x 100px)    -
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
------------------------------------------
Posted 23-Jun-13 21:29pm
Edited 23-Jun-13 21:32pm
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Try GridBagLayout instead GridLayout. See here
  Permalink  
Comments
Valentine1993 at 24-Jun-13 3:52am
   
Thank you. It works. Can i ask you a question...What does fill and weightx do?
Shubhashish_Mandal at 24-Jun-13 3:58am
   
all of your queries are mention in details with example in the link.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Also for you:
 
http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html[^]
 
a simple Borderlayout will do the trick.
 
You can also add various sized items in the Grldlayout (if needed to stay with that). IMHO the grid will render that.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 406
1 Marcin Kozub 225
2 Sergey Alexandrovich Kryukov 205
3 /\jmot 175
4 Shweta N Mishra 161
0 OriginalGriff 8,289
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,624
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 24 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100