我正在做一个项目,但我的框架有点问题,我的桌子有问题。
好吧,我有这个:
上一张图片的来源是:
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);
}
}
但我需要我的框架看起来像这样:
所以,你能帮我吗,我把所有东西都放在一个 GridLayout 中,但我需要最后一个表更大......但我不知道如何组织元素以按我想要的方式放置......