• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GUI question

 
Shay Gaghe
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
(Swing)
i have three questions :
1.im using null layout and i pathing the components with setBounds() , i see that the reshape() does the same thing , there is a different?
2.im extending Canvas and JPanel , how to get access to its container( like getContentPane() in a JFrame)?
3.how can i make my window to by fixed size (disable rsizing by the user)?
thanks
Shay
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to explain that to him before Cindy.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic