s_lavie
asked on
problem with JSplitPane.
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(JScro llPane1);
getContentPane().add(JScro llPane2);
JScrollPane1.getViewport() .add(JTabl e1);
JScrollPane2.getViewport() .add(JText Area1);
JSplitPane1.setTopComponen t(JScrollP ane1);
JSplitPane1.setBottomCompo nent(JScro llPane2);
// 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
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(JScro
getContentPane().add(JScro
JScrollPane1.getViewport()
JScrollPane2.getViewport()
JSplitPane1.setTopComponen
JSplitPane1.setBottomCompo
// 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
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
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
ASKER
mwibbels,
getContentPane().add(JScro llPane1);
getContentPane().add(JScro llPane2);
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?
getContentPane().add(JScro
getContentPane().add(JScro
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?
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
and
JSplitPane1.setTopComponen
Why are you adding the scrollpanes to both the JFrame and the JSplitPane. I think you should remove the 'getContentPane().add(JScr
getContentPane().add(JSpli