Hi,
I am trying to use a JSplitPane in Netbeans 6.9.1, but I can not configure it properly for some reason. E.g.
I add a jtree and a jtable in a jframe. Then I use "enclose in splitpane".
Then I set the orientation to vertical (from horizontal).
Problem, when I try to adjust the divider location, I can not place it where I want. Either it goes all the way up
or all the way down. After manually expanding one side, I get a format close to what I want.
I try to do the same, and create a second jsplitpane in the same jform.
Then I try to enclose both jsplitpane into another splitpane but the order of the splitpanes get reversed.
Am I doing something wrong or splitpanes are not working ok?
Thanks
UPDATE
public class Testing extends javax.swing.JFrame {
/** Creates new form Testing */
public Testing() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jSplitPane1 = new javax.swing.JSplitPane();
jScrollPane2 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jScrollPane1 = new javax.swing.JScrollPane();
jTree1 = new javax.swing.JTree();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setName("Form"); // NOI18N
jSplitPane1.setDividerLocation(5);
jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
jSplitPane1.setName("jSplitPane1"); // NOI18N
jScrollPane2.setName("jScrollPane2"); // NOI18N
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jTable1.setName("jTable1"); // NOI18N
jScrollPane2.setViewportView(jTable1);
jSplitPane1.setLeftComponent(jScrollPane2);
jScrollPane1.setName("jScrollPane1"); // NOI18N
jTree1.setName("jTree1"); // NOI18N
jScrollPane1.setViewportView(jTree1);
jSplitPane1.setRightComponent(jScrollPane1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(258, 258, 258))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>