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 / June 2005

Tip: Looking for answers? Try searching our database.

Automatically resize jtable

Thread view: 
Frank - 18 Jun 2005 21:32 GMT
Hi,

I'm using Eclipse to build a Java GUI (using JFC/Swing).  I have a Jtable
that is part of a jPanel.  However when my window resizes the table stays a
constant size.  How can I resize the jTable as the window size changes?

Thanks
Frank
Andrew Thompson - 19 Jun 2005 06:58 GMT
> ..How can I resize the jTable as the window size changes?

'Layouts'.  Beyond that..
It is easier to see what you are doing wrong when you supply code.
<http://www.physci.org/codes/sscce.jsp>

Signature

Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane

Frank - 19 Jun 2005 15:09 GMT
> > ..How can I resize the jTable as the window size changes?
>
[quoted text clipped - 8 lines]
> http://www.1point1C.org/  Science & Technology
> http://www.LensEscapes.com/  Images that escape the mundane

Ah, so probably a mistake using the NULL layout option.  Using eclipse it
had seemed easier to position my components if I chose NULL.  But I probably
am losing some functionality by doing that.

Frank
Andrew Thompson - 19 Jun 2005 15:26 GMT
> "Andrew Thompson" <SeeMySites@www.invalid> wrote in message
>>
>>> ..How can I resize the jTable as the window size changes?
>>
>> 'Layouts'.  
..
> Ah, so probably a mistake using the NULL layout option.  

Not *always*, but most usually.

>..Using eclipse it
> had seemed easier to position my components if I chose NULL.  But I probably
> am losing some functionality by doing that.

If you wish to get x-plat compatible GUI's, layouts using
components that return logical mimimum/preferred/maximum
sizes is definitely the way to go.

About the only time you need to set a 'null' layout is
when you are creating a layout yourself, then you need to
work out how big the layout itself needs to be so that it
can return logical values to it's parent containers.

I strongly recommend working through 'Using Layout Managers'[1],
to get a feel for what is possible.  Though I am not sure if
it adequately covers nested layouts..

[1] <http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html>

HTH

Signature

Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane

Filip Larsen - 19 Jun 2005 11:29 GMT
> I have a Jtable that is part of a jPanel.  However when my window
> resizes the table stays a constant size.  How can I resize the
> jTable as the window size changes?

Check out the JTable guide and look for "Adding a Table to a Container"
and "Setting and Changing Column Widths":

http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

Regards,
Signature

Filip Larsen



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



©2008 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.