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

Tip: Looking for answers? Try searching our database.

Absolute layout manager dimensions

Thread view: 
Jan Krumsiek - 25 Oct 2005 22:17 GMT
Hi again.

Is there any way to create a layout manager consisting of two cols where
the left has a width of 100px and the right one uses the rest of the
space available?

Something like HTML's <frameset cols="100,*"....>

Regards,
Jan
VisionSet - 25 Oct 2005 22:21 GMT
> Hi again.
>
[quoted text clipped - 3 lines]
>
> Something like HTML's <frameset cols="100,*"....>

Yes you can create your own LayoutManager to do whatever you like, not great
at making coffee though.
If you want a starting point from existing LayoutManagers, try a
BorderLayout using WEST and CENTER only, in WEST put a JPanel where you have
set preferredSize to have a width of 100px
Be sure you want to give explicit dimensions! Why do you want 100px?
Jan Krumsiek - 25 Oct 2005 22:29 GMT
> If you want a starting point from existing LayoutManagers, try a
> BorderLayout using WEST and CENTER only, in WEST put a JPanel where you have
> set preferredSize to have a width of 100px
> Be sure you want to give explicit dimensions! Why do you want 100px?

My application has a control panel (which shall 100px) and a plot area
where a graph is drawn... it shall use the rest of the available space.

Jan
VisionSet - 25 Oct 2005 22:44 GMT
> > If you want a starting point from existing LayoutManagers, try a
> > BorderLayout using WEST and CENTER only, in WEST put a JPanel where you have
[quoted text clipped - 3 lines]
> My application has a control panel (which shall 100px) and a plot area
> where a graph is drawn... it shall use the rest of the available space.

Then it is unlikely you want to fix size at all then.
You should use a fluid layout and use the layout mangers as they are
intended.
Your user decides the size of the window (or should do) and your application
should adjust its contents accordingly.
This is simplicity itself because there are enough layout managers to suit
99% of needs and that is there job.
You should invest some time suns layout manager tutorial for ex, will
quickly get you up to speed.

http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html

and especially

http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html
IchBin - 25 Oct 2005 22:53 GMT
> Hi again.
>
[quoted text clipped - 6 lines]
> Regards,
>  Jan

You can do this using JGoodies Forms. You can download the Freeware. I
love and use JGoodies forms and LAF Look libs for my Java apps.

http://www.jgoodies.com/freeware/formsdemo/index.html

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

IchBin - 25 Oct 2005 22:59 GMT
>> Hi again.
>>
[quoted text clipped - 11 lines]
>
> http://www.jgoodies.com/freeware/formsdemo/index.html

A specific link for JGoodies Forms is..

http://www.jgoodies.com/freeware/forms/index.html

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

Roedy Green - 25 Oct 2005 23:53 GMT
>Is there any way to create a layout manager consisting of two cols where
>the left has a width of 100px and the right one uses the rest of the
>space available?

not a Layout but something that behaves much like one. See
http://mindprod.com/jsplitpane.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Roedy Green - 25 Oct 2005 23:55 GMT
>Is there any way to create a layout manager consisting of two cols where
>the left has a width of 100px and the right one uses the rest of the
>space available?

When you are looking for a layout manager with certain properties,
check out my summary of them and what they do at
http://mindprod.com/jgloss/layout.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Andrew Thompson - 25 Oct 2005 23:59 GMT
> Is there any way to create a layout manager consisting of two cols where
> the left has a width of 100px and the right one uses the rest of the
> space available?
>
> Something like HTML's <frameset cols="100,*"....>

</hackish psuedo-code>
// nested layout
JPanel theApplication = new JPanel(new BorderLayout());
JPanel theControlPanel = new JPanel() {
  getPrefferedSize() {
    return new Dimension(100,getHeight());
  }
}
JPanel thePlotPanel = new JPanel();
theApplication.add( theControlPanel, BorderLayout.WEST );
theApplication.add( thePlotPanel, BorderLayout.CENTER );
<hackish pseudo-code>

I doubt your '100px' requirement though, if it contains
Java buttons and such, they should be in a layout, and the
panel should be able to tell you how much space it prefers.

HTH
Roedy Green - 26 Oct 2005 02:50 GMT
On Tue, 25 Oct 2005 22:59:09 GMT, Andrew Thompson
<seemysites@www.invalid> wrote, quoted or indirectly quoted someone
who said :

>I doubt your '100px' requirement though, if it contains
>Java buttons and such, they should be in a layout, and the
>panel should be able to tell you how much space it prefers.

But if you mean 100 pixels seriously, you can implement
getPreferredSize getMinimumSize and getMaximumSize or if in JDK 1.5+
use  setPreferredSize etc.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



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.