Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

panels not displayed fullly in Jframe

 
praveen shinde
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,
I have a Jframe. and I have added 5 panels in the jframe.
But when i run the program only 3 panels are displayed .rest of the panels are not displayed.
I have added a scrollbar. but it is not having any effect. The bottom end of the vertical scroll bar is not displayed when the program is run.
Any help is welcome
Regards,
Praveen Shinde.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Any help is welcome

what help would you like?
 
praveen shinde
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael,
I would like to solve my problem. I need to display the Jframe so that all the panels are displayed. So if you could tell me how to do it.
regards,
Praveen
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using any layout for the parent container which has the 5 children?
If yes which one?
Have you specified any preferred size for the parent or the children?
Does your child panels have further children? How are you confirming the 5 children are not being displayed?

TellTheDetails
 
praveen shinde
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Maneesh,

The layout for the parent Jframe is "Free Design"
The layout for the children panels is also "Free Design".
I can say that only 3 panels are displayed because when I execute the program it displays only the top 3 panels.
regards,
Praveen
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Free Design" is not part of the standard Java API.
Is it some third party layout? Or did you mean null layout?
 
praveen shinde
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry ,
I forgot to mention that we had used Netbeans 6.9 IDE drag & drop features to create the Jframe?panels.
So When I open the java file in the Design tab, I can see the different panels. then when I right click on the Jframe and select the set layout open it shows a Free Design option in bold. Hence I am saying it is free design layout.
Regards,
Praveen
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do yourself a favor. Drop the IDE DnD features! Most of us prefer to hand code. If you search the forums, you will find many discussions where people have cited reasons why DnD is a bad idea.

Coming back to your problem.
I would really recommend you hand code using the layout managers. http://download.oracle.com/javase/tutorial/uiswing/layout/visual.html
Different types of layoutmanagers offer different placement options.

1) On a piece of paper, draw how you want your UI to be
2) Based on that design, figure out which layout would suit your requirements
3) Remember you can nest different components with different layouts
4) If you still run into problems post your sscce code (Please do click on the link to find out what SSCCE means)
 
praveen shinde
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok , Thanks.
I will start with selecting the layouts without a IDE.
I will try it out and report my progress.
 
praveen shinde
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I wrote hand code using the layout managers(not DND of netbeans IDE) but all components in the panel are not visible.
Please help
Thanks
Praveen
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to post http://pscode.org/sscce.html version of your code which demonstrates the problem and which we can run on our machines. Without looking at the code, it is next to impossible to tell you whats going wrong.
 
praveen shinde
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
The following code creates a frame with several panels. In the employee panel all the components are not visible. Even the other panels are not displayed properly


Please help..
circle.GIF
[Thumbnail for circle.GIF]
square.GIF
[Thumbnail for square.GIF]
 
Darryl Burke
Bartender
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you actually read the SSCCE link posted? Your code contains a whole lot of stuff totally irrelevant to a layout, which is the nature of your problem. Default buttons, custom borders and uneditable text fields just add clutter.

You need to go through the Swing tutorials, and particularly the section on How to Use Scroll Panes, which you will find linked from the JScrollPane API. Apart form that --
-- Always construct and manipulate Swing components on the EDT. See the Concurrency in Swing section of the same tutorial for more details.
-- Your several createRigidArea(...) fised size spacers are liable to shatter the layout with a different font, resolution or LaF. Choosing the correct layout manager should facilitate getting rid of them.
-- Setting the preferredSize of containers is rarely the right way to go. Let the layout manager do its job without interference.

If you produce a true SSCCE, your chances of getting better help sooner are considerably improved.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic