Author: sletellier Date: 2012-06-27 16:44:36 +0200 (Wed, 27 Jun 2012) New Revision: 71 Url: http://forge.codelutin.com/repositories/revision/jmexico/71 Log: Use column model to fix column size Added: trunk/jmexico-editor/src/main/java/fr/reseaumexico/editor/InputDesignColumnModel.java Modified: trunk/jmexico-editor/src/main/java/fr/reseaumexico/editor/InputDesignEditor.jaxx Added: trunk/jmexico-editor/src/main/java/fr/reseaumexico/editor/InputDesignColumnModel.java =================================================================== --- trunk/jmexico-editor/src/main/java/fr/reseaumexico/editor/InputDesignColumnModel.java (rev 0) +++ trunk/jmexico-editor/src/main/java/fr/reseaumexico/editor/InputDesignColumnModel.java 2012-06-27 14:44:36 UTC (rev 71) @@ -0,0 +1,47 @@ +/* + * #%L + * JMexico :: Swing Editor + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 - 2012 Réseau Mexico, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +package fr.reseaumexico.editor; + +import javax.swing.table.DefaultTableColumnModel; +import javax.swing.table.TableColumn; + +/** + * @author sletellier <letellier@codelutin.com> + */ +public class InputDesignColumnModel extends DefaultTableColumnModel { + + public static final int FIRST_COLUMN_MIN_WIDTH = 400; + public static final int NEXT_COLUMNS_MIN_WIDTH = 150; + + @Override + public TableColumn getColumn(int columnIndex) { + TableColumn column = super.getColumn(columnIndex); + switch (columnIndex) { + case 0 : column.setMinWidth(FIRST_COLUMN_MIN_WIDTH);break; + default: column.setMinWidth(NEXT_COLUMNS_MIN_WIDTH);break; + } + return column; + } +} Modified: trunk/jmexico-editor/src/main/java/fr/reseaumexico/editor/InputDesignEditor.jaxx =================================================================== --- trunk/jmexico-editor/src/main/java/fr/reseaumexico/editor/InputDesignEditor.jaxx 2012-06-25 12:36:31 UTC (rev 70) +++ trunk/jmexico-editor/src/main/java/fr/reseaumexico/editor/InputDesignEditor.jaxx 2012-06-27 14:44:36 UTC (rev 71) @@ -68,7 +68,11 @@ </script> <JScrollPane constraints='BorderLayout.CENTER'> - <JTable id='inputDesignTable' model='{getModel()}' rowHeight='20'/> + <JTable id='inputDesignTable' + model='{getModel()}' + autoResizeMode='{JTable.AUTO_RESIZE_OFF}' + columnModel='{new InputDesignColumnModel()}' + rowHeight='20'/> </JScrollPane> <JPanel id='factorActionPanel' constraints='BorderLayout.SOUTH'>