ajayjain
asked on
how can i use 2 splitpanes with 3 components
dear,
i want to use 2 SplitPanes for spliting 3 components at a time . The code will make it more clear.
ScrollPane1,ScrollPane2,Sc rollPane3 are 3 scrollPanes having 3 components added to it.
sp1,sp2 are 2 SplitPanes.
panel is JPanel.
/* code*/
sp1 = new JSplitPane(JSplitPane.HORI ZONTAL_SPL IT,scrollP ane,scroll Pane1);
sp2 = new JSplitPane(JSplitPane.HORI ZONTAL_SPL IT,scrollP ane1,scrol lPane2);
panel1.add(sp1);
panel2.add(sp2);
Means i need to share scrollPane1 between 2 SplitPanes.
PROBLEM OCCURING : 2 SplitPanes are appered properly but only 1 is enabled which is added later i.e. splitPane2.
please give me the appropriate suggetions.
thanx in Advance
regards
AJAY JAIN
i want to use 2 SplitPanes for spliting 3 components at a time . The code will make it more clear.
ScrollPane1,ScrollPane2,Sc
sp1,sp2 are 2 SplitPanes.
panel is JPanel.
/* code*/
sp1 = new JSplitPane(JSplitPane.HORI
sp2 = new JSplitPane(JSplitPane.HORI
panel1.add(sp1);
panel2.add(sp2);
Means i need to share scrollPane1 between 2 SplitPanes.
PROBLEM OCCURING : 2 SplitPanes are appered properly but only 1 is enabled which is added later i.e. splitPane2.
please give me the appropriate suggetions.
thanx in Advance
regards
AJAY JAIN
Yes, that's the normal behaviour. You cannot add a component in two different locations on the screen (application). Use cloned scrollPane or another one synchronized with the original.
ASKER
Ya that's okkai.
To sove this problem wt i did is :
i added the mouse LIstener to both these SplitPanes.So that if i m using 1st splitPane then i must remove the scrollPane 1 from another SplitPane. and vise versa .
Means i dynamically trying to use scrollPane1 with both the SplitPane.
PROBLEM OCCURING : The mouse click event not able to detect the devider .
is there any way so that i could know which SplitPane devider is in use currently .
regards
AJAY JAIN
To sove this problem wt i did is :
i added the mouse LIstener to both these SplitPanes.So that if i m using 1st splitPane then i must remove the scrollPane 1 from another SplitPane. and vise versa .
Means i dynamically trying to use scrollPane1 with both the SplitPane.
PROBLEM OCCURING : The mouse click event not able to detect the devider .
is there any way so that i could know which SplitPane devider is in use currently .
regards
AJAY JAIN
The scrollPane and the holding splitpane will not receive mouse events because the events will be captured by the component contained by the scrollPane. You couls trick this if you will use something like this:
1. create a JPanel called scrollPaneHolder
2. set the layout to BorderLayout
3. Add to north a JLabel called titleLabel
4. Add to center the scrollPane
You will have as result a component which looks like a window, and you can use the JLabel (title), as mouseEvent notification component. When you click on the "window" in the left side, you will move the scrollPane from the right scrollPaneHolder. When you click on right you'll move'it from left. You could set some active/innactive collors to the JLabel and so you'll make a pretty intuitive and user friendly component.
Hope it will help you.
1. create a JPanel called scrollPaneHolder
2. set the layout to BorderLayout
3. Add to north a JLabel called titleLabel
4. Add to center the scrollPane
You will have as result a component which looks like a window, and you can use the JLabel (title), as mouseEvent notification component. When you click on the "window" in the left side, you will move the scrollPane from the right scrollPaneHolder. When you click on right you'll move'it from left. You could set some active/innactive collors to the JLabel and so you'll make a pretty intuitive and user friendly component.
Hope it will help you.
> ScrollPane1,ScrollPane2,Sc rollPane3 are 3 scrollPanes having 3 components added to it.
What happended to ScrollPane3??
What happended to ScrollPane3??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
heyyy thanx "object"
Your idea working.
regards
AJAY JAIN
Your idea working.
regards
AJAY JAIN
good to hear :)