I’m doing a project but I have a little problem with a Frame, I have a problem with a table.
Well, I have this:

The source that have for the previous picture is:
public class Geotools04 extends JFrame {
private JMapFrame mapFrame;
static StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(null);
static FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(null);
Geotools04(File[] files) throws IOException, CQLException {
FileDataStore store = FileDataStoreFinder.getDataStore(files[0]);
SimpleFeatureSource featureSource = store.getFeatureSource();
Filter filter = CQL.toFilter("MAN_COD = '01'");
SimpleFeatureCollection features = featureSource.getFeatures(filter);
FeatureCollectionTableModel model = new FeatureCollectionTableModel(features);
for(int i=0;i<model.getColumnCount();i++){
System.out.println(model.getColumnName(i));
}
JFrame frame = new JFrame();
JTable table = new JTable();
frame.setLayout(new GridLayout(6, 2)) ;
JLabel a = new JLabel("Capas existentes:");
JComboBox layer = new JComboBox();
for(int i=0; i < files.length ; i++){
layer.addItem(files[i].getName());
}
JLabel c = new JLabel("Atributos de capa:");
JComboBox d = new JComboBox();
d.addItem ("MAN_COD");
JCheckBox e = new JCheckBox("Where");
JTextField f = new JTextField("= '01'");
JCheckBox g = new JCheckBox("Where igual");
JTextField h = new JTextField("01");
h.setEditable(false);
JCheckBox i = new JCheckBox("Todos los registros");
JButton j = new JButton("Consultar");
frame.add(a);
frame.add(layer);
frame.add(c);
frame.add(d);
frame.add(e);
frame.add(f);
frame.add(g);
frame.add(h);
frame.add(i);
frame.add(j);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.setModel(new DefaultTableModel(5, 5));
table.setPreferredScrollableViewportSize(new Dimension(500, 200));
JScrollPane scrollPane = new JScrollPane(table);
table.setModel(model);
frame.add(scrollPane);
frame.setSize(600, 600);
frame.setVisible(true);
}
}
But I need that my frame look like this:

So, can you help me, I put all in a GridLayout but I need that the last table
be bigger… But I don’t know how to organize the element for put in the way that
I want to…
Try like this:
Instead of adding components directly on
JFramecreate separateJPaneland add all components exceptJScrollPane(which containsJTable) and “Salir” button.Set
BorderLayoutfor yourJFrame.Set
GridLayoutfor thatJPaneladd components and add thatJPaneltoNORTHofJFrame.Add
JScrollPanetoCENTERof yourJFrameYou can add your “Salir” button directly to
SOUTHof frame or you can create one moreJPaneladd “Salir” button to thatJPaneland finally addJPaneltoSOUTHof frame:or
P.S. Don’t forget to call
frame.pack();instead offrame.setSize();before callingframe.setVisible();method!EDIT
Consider using some other layout for your upper components, like GridBagLayout
or MiG Layout instead of GridLayout.