• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting the null layout for JMenuBar in JApplet

 
Muhammad Imran Saeed
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I need to set the null layout for the JMenuBar what i have found till now is that default layout is BoxLayout for the JMenuBar but it deosnt solve my problem. following is my code sample


Any help in this regard will be highly appericiated
 
Maneesh Godbole
Saloon Keeper
Posts: 11312
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to set the bounds after adding the child to the parent.

What exactly are you trying to do by setting the layout to null?
 
Muhammad Imran Saeed
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I have to add some other component(s) to MenuBar at the right side i.e a Button and label and there will be some space in between them. And i have to align the Button to some other component ...
 
Maneesh Godbole
Saloon Keeper
Posts: 11312
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok.
Like I said calling the set bounds after adding the child to the parent will fix your problem.

Setting the layout to null will give you immense grief if the applet is resized.
You might want to consider some other suitable layout (BorderLayout.EAST and BorderLayout.WEST for example) which would give you the same results and will take care of the resizing for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic