| | |
No able to set the jpanel positions
![]() |
•
•
Join Date: Feb 2006
Posts: 10
Reputation:
Solved Threads: 0
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
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
•
•
•
•
Originally Posted by javafan
You mean to say I have no control over the display
Then how do I do this?
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*
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.
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.
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:
Here is the description of GridbagLayout from java.sun, http://java.sun.com/docs/books/tutor...t/gridbag.html
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:
Java Syntax (Toggle Plain Text)
GridBagLayout gridbag = new GridBagLayout(); this.getContentPane().setLayout(gridbag); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; //to add components you just asign a grid position and a weight g.gridx=0;c.gridy=0;c.weightx=2;c.weighty=0;this.getContentPane().add(component,c);
![]() |
Similar Threads
Other Threads in the Java Forum
- Previous Thread: Execute Java app question
- Next Thread: java help for newbie
| Thread Tools | Search this Thread |
add android api applet application applications array arrays automation bank binary bluetooth chat class clear client code codesnippet collections component converter database development dice digit eclipse equation error event formatingtextintooltipjava fractal functiontesting game givemetehcodez graphics gui health html hyper ide idea image infinite input int integer j2me java javame javaprojects jni jpanel julia linux list loop looping main map method methods mobile myregfun mysql netbeans newbie nonstatic openjavafx parameter pearl php print problem program programming project recursion repositories scanner scrollbar server set size sms sort sorting spamblocker sql sqlserver state storm string superclass swing swt text-file thread threads tree windows






