aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes panels not displayed fullly in Jframe Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "panels not displayed fullly in Jframe" Watch "panels not displayed fullly in Jframe" New topic
Author

panels not displayed fullly in Jframe

praveen shinde
Ranch Hand

Joined: Jun 03, 2009
Posts: 63
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

Joined: Jun 09, 2003
Posts: 4632
> Any help is welcome

what help would you like?
praveen shinde
Ranch Hand

Joined: Jun 03, 2009
Posts: 63
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

Joined: Jul 26, 2007
Posts: 10523
    
    9

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


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
praveen shinde
Ranch Hand

Joined: Jun 03, 2009
Posts: 63
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

Joined: Jul 26, 2007
Posts: 10523
    
    9

"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

Joined: Jun 03, 2009
Posts: 63
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

Joined: Jul 26, 2007
Posts: 10523
    
    9

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

Joined: Jun 03, 2009
Posts: 63
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

Joined: Jun 03, 2009
Posts: 63
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

Joined: Jul 26, 2007
Posts: 10523
    
    9

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

Joined: Jun 03, 2009
Posts: 63
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..


[Thumbnail for circle.GIF]

[Thumbnail for square.GIF]

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4658
    
    5

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.


luck, db
There are no new questions, but there may be new answers.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: panels not displayed fullly in Jframe