Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2003

Tip: Looking for answers? Try searching our database.

Empty space between objects

Thread view: 
Passero - 19 Dec 2003 13:49 GMT
How can i put empty space between the border of my JFrame and the objects i
put on the screen? I'm using a GridLayout with 3 rows and 1 column, the
problem is that my screen i completly filled with the elements; How can i
tell the GridLayout or the frame that i need an empty space between the
gridlayout and the frame?
VisionSet - 19 Dec 2003 15:11 GMT
> How can i put empty space between the border of my JFrame and the objects i
> put on the screen? I'm using a GridLayout with 3 rows and 1 column, the
> problem is that my screen i completly filled with the elements; How can i
> tell the GridLayout or the frame that i need an empty space between the
> gridlayout and the frame?

Apply the Gridlayout to a JComponent, add that to the frame and do:
myJComponent.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); // or
similar

Signature

Mike W

VisionSet - 19 Dec 2003 15:15 GMT
> > How can i put empty space between the border of my JFrame and the objects
> i
[quoted text clipped - 6 lines]
> myJComponent.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); // or
> similar

or if you don't mind space between your 3 grid cells as well then just do

new GridLayout(3,0,10,10); where 10,10 is the space between cells in x & y

Signature

Mike W

Andrew Thompson - 19 Dec 2003 18:17 GMT
...
> new GridLayout(3,0,10,10); where 10,10 is the space between cells in x & y

teh! (rolls eyes)

Well for pity's sake Mike, I thought my
answer was entirely adequate.  Before
_you're_ done you'll have written a SSCE
with buttons to adjust the border size!

Leave some work for the _OP_      ;-)
VisionSet - 19 Dec 2003 18:40 GMT
> ...
> > new GridLayout(3,0,10,10); where 10,10 is the space between cells in x & y
[quoted text clipped - 7 lines]
>
> Leave some work for the _OP_      ;-)

I try and look at this forum as, rather selfishly, a learning experience for
me.
If someone asks and I think I can answer i shall in as full a manner as I am
able and my time allows, or I can be bothered to muster.  If it is wrong I
shall learn more than posting myself, because people seem more willing to
'set you right' than 'help you out' ;-)
But that is usenet in general, certainly a more helpful and down right nice
bunch you couldn't hope to come across than on c.l.j.* :-)
Signature

Mike W

Andrew Thompson - 19 Dec 2003 17:03 GMT
> How can i put empty space between the border of my JFrame and the objects i
> put on the screen?

javax.swing.border.EmptyBorder

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.