From 3f655e7a0f0aa4d6ffe59e27a285f3bebfb2973a Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 9 Jun 2017 17:21:15 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-2561=20=E5=A4=A7=E5=B1=8F-=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E6=97=B6=E9=92=9F=E6=8F=92=E4=BB=B6=EF=BC=8C=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E8=A1=A8=E5=B7=A6=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../properties/WidgetPropertyTable.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java b/designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java index 32fc44df6..07621fc26 100644 --- a/designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java +++ b/designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java @@ -27,7 +27,6 @@ public class WidgetPropertyTable extends AbstractPropertyTable { private FormDesigner designer; private static final int LEFT_COLUMN_WIDTH = 97; // "属性名"列的宽度 - private static final int RIGHT_COLUMN_WIDTH = 138; // "属性值"列的宽度 public WidgetPropertyTable(FormDesigner designer) { super(); @@ -86,16 +85,21 @@ public class WidgetPropertyTable extends AbstractPropertyTable { } TableModel model = new BeanTableModel(); setModel(model); + this.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); TableColumn tc = this.getColumn(this.getColumnName(0)); tc.setMinWidth(LEFT_COLUMN_WIDTH); tc.setMaxWidth(LEFT_COLUMN_WIDTH); - TableColumn tcRight = this.getColumn(this.getColumnName(1)); - tcRight.setMinWidth(RIGHT_COLUMN_WIDTH); - tcRight.setMaxWidth(RIGHT_COLUMN_WIDTH); this.repaint(); } + private void setRightColumnWidth(boolean automode) { + int rightColumnWidth = this.getWidth() - LEFT_COLUMN_WIDTH; + TableColumn tcRight = this.getColumn(this.getColumnName(1)); + tcRight.setMinWidth(automode ? 0 : rightColumnWidth); + tcRight.setMaxWidth(automode ? this.getWidth() : rightColumnWidth); + } + private void setDesigner(FormDesigner designer) { this.designer = designer; } @@ -117,6 +121,13 @@ public class WidgetPropertyTable extends AbstractPropertyTable { return null; } + @Override + public void columnMarginChanged(javax.swing.event.ChangeEvent e) { + setRightColumnWidth(false); + super.columnMarginChanged(e); + setRightColumnWidth(true); + } + /** * 待说明 */