Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JPanel using NullLayout  RSS feed

 
narender reddy
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all how should we set the JPanel in the null Layout and dimensions criteria
 
Campbell Ritchie
Sheriff
Posts: 53769
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Preferably, not at all. You are usually better off with a LayoutManager than null layout.
Tutorials about GridbagLayout here, and here (maybe more useful), and a useful class which makes GridBag easier to use here. Find Horstmann's book (C Horstmann, G Cornell, Core Java 2 vol I: Fundamentals, 7/e, Santa Clara CA: Sun MicroSystems Press (Prentice-Hall) (2004) pages 430-439), which tells you about GridBag and the GBC class. Go through the GBC class, work out how it works, then write your own along the same lines.

If you must use null layout, you need to set the size and position of every component separately; using setBounds(int, int, int, int) is probably the easiest way to do it.

CR
 
Sridevi alla
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using Visual Editor in that one Properties file View is there, we can change the Layout as null,

sridevi
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!