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.
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
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?
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
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
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.
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)
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.
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
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.