displaying JSplitPane in JPanel
hello everybody,
i wanted Jsplitpane to be added in a Jpanel, which i further added to frame,
when i add jsplitpane directly to frame, it works well.
here is the code,
import javax.swing.*;
class splitpanedemo{
JSplitPane jp;
splitpanedemo(){
JFrame jf=new JFrame("demo");
jp=new JSplitPane();
jf.show();
jf.setVisible(true);
jf.add(jp);
jf.setSize(1500,1500);
}
public static void main(String[] args){
new splitpanedemo();
}
}
but when i want jsplitpane to be added on a panel, which i did through this code
import javax.swing.*;
class splitpanedemo{
JSplitPane jp;
JPanel jpa;
splitpanedemo(){
JFrame jf=new JFrame("demo");
jpa=new JPanel();
jp=new JSplitPane();
jf.show();
jf.setVisible(true);
jpa.add(jp);
jf.add(jpa);
jf.setSize(1500,1500);
}
public static void main(String[] args){
new splitpanedemo();
} }
this won't work well, the output differs,
the divider won't work well,
plz help me out of this.
thank you in advance.