I've setting up a simple gui that shows a JTable when pressing a JButton, and i have no problem with this. My problem is that when the JTable is loaded, it overlaps the button(s). I think I can manage this with BorderLayout, I have used it with the JTable, but I can't figured out how setting BorderLayout parameters for the buttons, as I added them with the NetBeans design view.
JTable dataTable=new JTable(data,columns);
this.setLayout(new BorderLayout());
JScrollPane pane=new JScrollPane(dataTable);
this.add(pane,BorderLayout.NORTH);
getContentPane().validate();
getContentPane().repaint();
As I said the buttons are added automatically by the Netbeans design view. Feel free to suggest me other code improvements if you want, I'm learning.
And when I scroll the JTable the JButtons scrolls too...Like they are in the same JScroll pane as the JTable.
This is how i would like it to be.
With the JButtons and the JTextField that remain at the same distance from the JTable, also when I scroll it.