Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

problem with JSplitPane.

Posted on 1999-07-19
5
Medium Priority
?
582 Views
Last Modified: 2012-08-13
Hi,
I want a JFrame (which contains a JSplitPane) to have a JTable on its top, and a JTextArea on its bottom, but for some reason when running the program, I can only see the JTable. I can see the JSplitPane's divider under the JTable, but I can't move it with the mouse.

follwing the relevant code (in the JFrame constructor):
    getContentPane().add(JScrollPane1);
    getContentPane().add(JScrollPane2);
    JScrollPane1.getViewport().add(JTable1);
    JScrollPane2.getViewport().add(JTextArea1);
    JSplitPane1.setTopComponent(JScrollPane1);
    JSplitPane1.setBottomComponent(JScrollPane2);
    // for all components Autoscrolls = true.

Do you see any problem with that code? is something crucial missing?
Can you post me a code that do what I want smoothly?
BTW I'm using VCafe 3 (if its matter).

Thanks
0
Comment
Question by:s_lavie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:mwibbels
ID: 1246447
                   getContentPane().add(JScrollPane1);

and
                    JSplitPane1.setTopComponent(JScrollPane1);

Why are you adding the scrollpanes to both the JFrame and the JSplitPane. I think you should remove the 'getContentPane().add(JScrollPane1);' and 'getContentPane().add(JScrollPane2);' lines. And you should probably add the line

getContentPane().add(JSplitPane1)
0
 
LVL 7

Expert Comment

by:conick
ID: 1246448
Someone else asked a question similar to this where they could not programically  move the divider.  
I mentioned that the divider does not allow a component to be smaller than its minimum size.  Alot of times you have to manually set the minimum size of the top and bottom components to allow the divider to move.
However in the particular question that I mentioned it was not the problem.  But it something you could maybe try.
Good Luck
0
 
LVL 2

Author Comment

by:s_lavie
ID: 1246449
mwibbels,
getContentPane().add(JScrollPane1);
getContentPane().add(JScrollPane2);
its a code that was added by VCafe, I removed those lines, but no help.

conick, I know I get minimum divider location (=27 in the program). Is that what you meant??? how can I set minimum divider location?
 
Have any of you programed such a program, and it worked? Maybe its a VCafe bug?

0
 
LVL 2

Author Comment

by:s_lavie
ID: 1246450
Hi conick,
I understand now, you meant
> the minimum size of the top and bottom components
I didn't notice that before, but it did help.
Thanks a lot, post an answer and get your points.
0
 
LVL 7

Accepted Solution

by:
conick earned 200 total points
ID: 1246451
Great! Thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question