This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes work without layout-mmanager - still crossplatforms Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "work without layout-mmanager - still crossplatforms" Watch "work without layout-mmanager - still crossplatforms" New topic

work without layout-mmanager - still crossplatforms

Omer Can

Joined: Apr 09, 2011
Posts: 5
Hi all,

As we thanks to JAVAs layout-managers, the programs we come up with are true cross-platform.
Weather those programs are started in Windows, OS-X, GT+, Linux, Anddroid (and Apple Tablets?)
the components we add to the JFrama of our proggrams, these will be outlined perfectly thanks
to he existing if those layout-managers (makes no difference which one we use).

But...I do not like to use either one of those layout-managers.

With setlayout( null); we can tell Java that we do not want to use either one of its layout-managers
and with eg MyTextField.setbounds(200,150,130,25); we can set each control its position and size
by ourelves.

Now my question:

I only have a pc to my use and can not checkout this question by trying the project on e.g. an APPLE OS-X:

If I switch off Javas layout-manager-usage and set each components place on the JFrAME and its size by
myself, will those controls still be outlined for me on each operating system perfectly by tje JRE Runtime

Thank you for answering

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10747

Your swing application will work only on platforms which support the Swing libraries. Android does not.

When you specify the bounds, the components will be rendered exactly as per the bounds. If your end user has say a bigger/smaller screen, then the UI will obviously suck. This is precisely the reason one should use layout managers.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Omer Can

Joined: Apr 09, 2011
Posts: 5
Thanks Maneesh Godbole

So, to program for Android, I can not use the SWING-package? Bummer!
Android SDK instead?!

Tony Docherty

Joined: Aug 07, 2007
Posts: 2728
But...I do not like to use either one of those layout-managers.

There are lots of different layout managers not just two. Java comes with many different ones and there are other third party ones which can be downloaded such as MigLayout.

I agree. Here's the link:
subject: work without layout-mmanager - still crossplatforms
It's not a secret anymore!