I have a question in relation to adding components to a Java frame.
I have a JPanel with two buttons and also a JScrollPane that has a JTable added to it. I am wanting to add both these to a JFrame.
I can add either the JPanel to the JFrame, or the JScrollPane to the JFrame and they display correctly. I am having trouble adding them both to the JFrame and displaying them both.
Is there something related to JFrames that do not allow this? Any help will be appreciated.
EDIT
The problem is not with the layout (at least I do not think that it is), the problem is that the ScrollPane is not displaying correctly. Here is an image to show what I mean:
http://canning.co.nz/Java/ScrollPane.png
Here is the code:
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridwidth = GridBagConstraints.REMAINDER;
guiPanel.add(scrollPane, gbc);
guiPanel.add(buttons, gbc);
guiFrame.add(guiPanel, BorderLayout.CENTER);
guiFrame.setVisible(true);