No able to set the jpanel positions

Reply

Join Date: Feb 2006
Posts: 10
Reputation: javafan is an unknown quantity at this point 
Solved Threads: 0
javafan javafan is offline Offline
Newbie Poster

No able to set the jpanel positions

 
0
  #1
Feb 8th, 2006
Hi
I am not able to set the position of Jpanel, having a tough time.

Code is attached.
1. How can I reduce the gap between
To and textbox
Cc and textbox
etc
2. How can I reduce the vertical space between Send/Contact/Spell/.... and the row containing To with textbox
I read tutorial like
http://www.leepoint.net/notes-java/G...ridlayout.html
but no avail
Someone please help me
Thanks
Attached Files
File Type: java EmailWindow2.java (10.3 KB, 4 views)
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: No able to set the jpanel positions

 
0
  #2
Feb 9th, 2006
the JVM determines component spacing and sizing at runtime. It's pretty much out of your hands.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 10
Reputation: javafan is an unknown quantity at this point 
Solved Threads: 0
javafan javafan is offline Offline
Newbie Poster

Re: No able to set the jpanel positions

 
0
  #3
Feb 9th, 2006
You mean to say I have no control over the display
Then how do I do this?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: No able to set the jpanel positions

 
0
  #4
Feb 9th, 2006
Originally Posted by javafan
You mean to say I have no control over the display
Then how do I do this?
Jwenting just said "It's pretty much out of your hands."



I don't see what the problem is, how it looks is just pointless fluff. If it works it works. What more do you want.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: No able to set the jpanel positions

 
0
  #5
Feb 9th, 2006
you have absolute control over the way the components are displayed in relation to each other.
You have very little control over how (what size and visual style) they're displayed at.

This is deliberate to enable the JVM to make it look decent on different operating systems that have different ways of doing things.
If you go and set that an input control is X pixels by Y pixels with a border of Z pixels that may look great on your Windows machine but completely crappy on a Mac or X terminal.
It may even be impossible to render there at all at that size.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 17
Reputation: ROGENATOR is an unknown quantity at this point 
Solved Threads: 0
ROGENATOR's Avatar
ROGENATOR ROGENATOR is offline Offline
Newbie Poster

Re: No able to set the jpanel positions

 
0
  #6
Feb 9th, 2006
Greetings:
You could try with GridBagLayout, it allows you to control a little more the appereance by using weights for the spaces that the components use, something like this:
  1. GridBagLayout gridbag = new GridBagLayout();
  2. this.getContentPane().setLayout(gridbag);
  3. GridBagConstraints c = new GridBagConstraints();
  4. c.fill = GridBagConstraints.BOTH;
  5. //to add components you just asign a grid position and a weight
  6. g.gridx=0;c.gridy=0;c.weightx=2;c.weighty=0;this.getContentPane().add(component,c);
Here is the description of GridbagLayout from java.sun, http://java.sun.com/docs/books/tutor...t/gridbag.html
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: No able to set the jpanel positions

 
0
  #7
Feb 9th, 2006
You could always set the layout to null and set the bounds, but I don't know if that's a good idea or not...... That is, if you are talking about positioning components.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: No able to set the jpanel positions

 
0
  #8
Feb 10th, 2006
NullLayout is never recommended except on platforms where there is no other layout manager available (maybe some mobile platforms).
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC