Advertisement

12.01.2008 at 01:51AM PST, ID: 23946203
[x]
Attachment Details

Adding JPanels to JFrame

[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.6
Hi experts,
I have made an application. I need your valuable help in solving a doubt I encountered. I have attached the screenshot in http://docs.google.com/Doc?id=dfzrknk_25hb7cpdgc
As you can see from the screenshot, I have added two JPanels to a frame. The first JPanel(panel1) is the one containing icons and the second(panel2) contains a JScrollpane to which a JTable is added.
The code I used is given below.

this.getContentPane().add(panel1, BorderLayout.NORTH);
this.getContentPane().add(panel2.panTab, BorderLayout.CENTER);



As i told above, panel2 contains a scrollpane to which a JTable is added(as can be seen from the screenshot).
My requirement is that, I need to split this second JPanel into two parts(70% and 30%). 70% of this JPanel should contain the already existing scrollpane and 30% of this JPanel should include another JPanel with few text boxes.
I tried to do this with the below given code, But I did not get the proper output , ie;when I maximize the frame only, I can see the search_constraints panel(newly created panel which was added to panel2).

JPanel panel2 = new JPanel();
panel2.add(scrollpanTable, BorderLayout.NORTH);//adding scrollpane containing JTable
panel2.add(search_constraints, BorderLayout.CENTER);//adding JPanel containing textboxes
//ADDING PANELS TO FRAME
this.getContentPane().add(panel1, BorderLayout.NORTH);
this.getContentPane().add(panel2, BorderLayout.CENTER);


Please help me in solving this issue.
Any help in this regard will be well appreciated with points.

Warm Regards,
Sreejith
Answered By: ksivananth
Expert Since: 02/26/2001
Accepted Solutions: 737
Computer Expertise: Beginner
ksivananth has been an Expert for 7 years 10 months, during which he has posted 3168 comments and answered 737 questions. ksivananth is just one of 1205 experts in the Java Programming Language Zone. 2 experts collaborated on this answer, which was graded an "A" by the asker.
 
 
 
 
20081119-EE-VQP-47 - Hierarchy / EE_QW_2_20070628