File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes GUI question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "GUI question " Watch "GUI question " New topic

GUI question

Shay Gaghe
Ranch Hand

Joined: Sep 03, 2001
Posts: 102
i have three questions : using null layout and i pathing the components with setBounds() , i see that the reshape() does the same thing , there is a different? extending Canvas and JPanel , how to get access to its container( like getContentPane() in a JFrame)? can i make my window to by fixed size (disable rsizing by the user)?
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
1 Using a null layout is REALLY not a good idea. It is very difficult to know what the screen will look like on different operating system and after the user is done messing with it. A LayoutManager will save you a ton of headaches in the long run.
reshape is deprecated. Don't use it.
2. Canvas is not a part of Swing and does not have a ContentPane. Only top level Containers have contentPanes anyway. Canvas is not a container. You can not do an add() to canvas.
3. If you had a LayoutManager you wouldn't need to ask this question.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
I tried to explain that to him before Cindy.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

Null layout is not a bad thing. I use null layout for everything and have no problems with crossplatform. You just have to cover your basis.
1. Don't let the user resize any windows
2. Restrict the user to a minimum screen resolution. (most will agree the min is 800X600)
3. Set a universal Font so that it is the same on all platforms
I have been doing that, and have not had a problem as of yet.
Just my two cents

Happy Coding,
Gregg Bolinger

GenRocket - Experts at Building Test Data
I agree. Here's the link:
subject: GUI question
It's not a secret anymore!