javax.swing.table.TableColumn.addPropertyChangeListener()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(12.2k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中javax.swing.table.TableColumn.addPropertyChangeListener()方法的一些代码示例,展示了TableColumn.addPropertyChangeListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableColumn.addPropertyChangeListener()方法的具体详情如下:
包路径:javax.swing.table.TableColumn
类名称:TableColumn
方法名:addPropertyChangeListener

TableColumn.addPropertyChangeListener介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

  1. TableColumn col=table.getColumnModel().getTableColumn(colNumber);
  2. col.addPropertyChangeListener(new PropertyChangeListener() {
  3. public void propertyChanged(PropertyChangeEvent e) {
  4. // has the column width changed ?
  5. }
  6. });

代码示例来源:origin: tinyMediaManager/tinyMediaManager

  1. private void initListeners() {
  2. // install a listener to cause the whole table to repaint when a column is resized. we do this because the extended grid
  3. // lines may need to be repainted. this could be cleaned up, but for now, it works fine.
  4. PropertyChangeListener listener = createTableColumnWidthListener();
  5. for (int i = 0; i < fTable.getColumnModel().getColumnCount(); i++) {
  6. fTable.getColumnModel().getColumn(i).addPropertyChangeListener(listener);
  7. }
  8. }

代码示例来源:origin: cpesch/RouteConverter

  1. private void addColumn(int columnIndex, TableColumn aColumn) {
  2. if (aColumn == null) {
  3. throw new IllegalArgumentException("Object is null");
  4. }
  5. tableColumns.add(columnIndex, aColumn);
  6. aColumn.addPropertyChangeListener(this);
  7. recalcWidthCache();
  8. // post columnAdded event notification
  9. fireColumnAdded(new TableColumnModelEvent(this, columnIndex, columnIndex));
  10. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui

  1. public void addColumn(TableColumn column) {
  2. super.addColumn(column);
  3. final int index = column.getModelIndex();
  4. column.addPropertyChangeListener(new PropertyChangeListener() {
  5. public void propertyChange(PropertyChangeEvent evt) {
  6. if (PROP_COLUMN_WIDTH.equals(evt.getPropertyName())) {
  7. int oldWidth = ((Integer)evt.getOldValue()).intValue();
  8. int newWidth = ((Integer)evt.getNewValue()).intValue();
  9. fireColumnWidthChanged(index, oldWidth, newWidth);
  10. }
  11. }
  12. });
  13. }

代码示例来源:origin: net.sf.sfac/sfac-core

  1. @Override
  2. public void addColumn(TableColumn aColumn) {
  3. // if this method is called, column number is updated from the outside.
  4. // Most likely, a new column set is added after all previous columns have been removed.
  5. // In this case we consider that all the columns are shown
  6. // and we have to resynchronize with supreclass content
  7. synchWithSuperclass();
  8. // add the column
  9. aColumn.removePropertyChangeListener(widthListener);
  10. aColumn.addPropertyChangeListener(widthListener);
  11. allColumns.add(aColumn);
  12. hidingSelectionDialog = null;
  13. super.addColumn(aColumn);
  14. }

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

  1. revalidateScrollBar();
  2. } else if ("treeColumnIndex".equals(evt.getPropertyName())) { // NOI18N
  3. treeTable.getColumnModel().getColumn(((TreeTable)treeTable).getTreeColumnIndex()).addPropertyChangeListener(listener);
  4. } else if ("column_moved".equals(evt.getPropertyName())) { // NOI18N
  5. int from = ((Integer)evt.getOldValue()).intValue();

代码示例来源:origin: com.eas.platypus/platypus-js-forms

  1. /**
  2. * Constructs model column, bounded with view's column.
  3. *
  4. * @param aName
  5. * @param aOnRender
  6. * @param aOnSelect
  7. * @param aReadOnly
  8. * @param aView
  9. * @param aEditor
  10. */
  11. public ModelColumn(String aName, JSObject aOnRender, JSObject aOnSelect, boolean aReadOnly, ModelWidget aView, ModelWidget aEditor) {
  12. super();
  13. name = aName;
  14. onRender = aOnRender;
  15. onSelect = aOnSelect;
  16. readOnly = aReadOnly;
  17. view = aView;
  18. super.setCellRenderer(aView);
  19. editor = aEditor;
  20. super.setCellEditor(editor);
  21. super.setWidth(50);
  22. tempWidth = super.getWidth();
  23. tempMinWidth = super.getMinWidth();
  24. tempMaxWidth = super.getMaxWidth();
  25. tempResizable = super.getResizable();
  26. tempMoveable = moveable;
  27. super.addPropertyChangeListener((PropertyChangeEvent evt) -> {
  28. changeSupport.firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
  29. });
  30. }

代码示例来源:origin: org.xworker/xworker_core

  1. public static void createPropertyChangeListeners(ActionContext actionContext){
  2. Thing self = (Thing) actionContext.get("self");
  3. TableColumn parent = (TableColumn) actionContext.get("parent");
  4. for(Thing child : self.getChilds()){
  5. PropertyChangeListener obj = (PropertyChangeListener) child.doAction("create", actionContext);
  6. if(obj != null){
  7. parent.addPropertyChangeListener(obj);
  8. }
  9. }
  10. }

代码示例来源:origin: khuxtable/seaglass

  1. /**
  2. * Adds striping to the background of the given {@link JTable}. The actual
  3. * striping is installed on the containing {@link JScrollPane}'s
  4. * {@link JViewport}, so if this table is not added to a {@code JScrollPane}
  5. * , then no stripes will be painted. This method can be called before the
  6. * given table is added to a scroll pane, though, as a
  7. * {@link PropertyChangeListener} will be installed to handle "ancestor"
  8. * changes.
  9. *
  10. * @param table the table to paint row stripes for.
  11. */
  12. public static void setViewPortListeners(JTable table) {
  13. table.addPropertyChangeListener("ancestor", createAncestorPropertyChangeListener(table));
  14. // Install a listener to cause the whole table to repaint when a column
  15. // is resized. We do this because the extended grid lines may need to be
  16. // repainted. This could be cleaned up, but for now, it works fine.
  17. for (int i = 0; i < table.getColumnModel().getColumnCount(); i++) {
  18. table.getColumnModel().getColumn(i).addPropertyChangeListener(createAncestorPropertyChangeListener(table));
  19. table.getColumnModel().addColumnModelListener(createTableColumnModelListener(table));
  20. }
  21. }

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

  1. private void installColumn(TableColumn column) {
  2. this.column = column;
  3. column.addPropertyChangeListener(getColumnListener());
  4. updateFromColumnHeader(column.getHeaderValue());
  5. // #429-swing: actionCommand must be string
  6. if (column.getIdentifier() != null) {
  7. setActionCommand(column.getIdentifier().toString());
  8. }
  9. boolean visible = (column instanceof TableColumnExt) ?
  10. ((TableColumnExt) column).isVisible() : true;
  11. updateFromColumnVisible(visible);
  12. }

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

  1. private void installColumn(TableColumn column) {
  2. this.column = column;
  3. column.addPropertyChangeListener(getColumnListener());
  4. updateFromColumnHeader(column.getHeaderValue());
  5. // #429-swing: actionCommand must be string
  6. if (column.getIdentifier() != null) {
  7. setActionCommand(column.getIdentifier().toString());
  8. }
  9. boolean visible = (column instanceof TableColumnExt) ?
  10. ((TableColumnExt) column).isVisible() : true;
  11. updateFromColumnVisible(visible);
  12. }

代码示例来源:origin: org.swinglabs.swingx/swingx-core

  1. private void installColumn(TableColumn column) {
  2. this.column = column;
  3. column.addPropertyChangeListener(getColumnListener());
  4. updateFromColumnHeader(column.getHeaderValue());
  5. // #429-swing: actionCommand must be string
  6. if (column.getIdentifier() != null) {
  7. setActionCommand(column.getIdentifier().toString());
  8. }
  9. boolean visible = (column instanceof TableColumnExt) ?
  10. ((TableColumnExt) column).isVisible() : true;
  11. updateFromColumnVisible(visible);
  12. }

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

  1. private void installColumn(TableColumn column) {
  2. this.column = column;
  3. column.addPropertyChangeListener(getColumnListener());
  4. updateFromColumnHeader(column.getHeaderValue());
  5. // #429-swing: actionCommand must be string
  6. if (column.getIdentifier() != null) {
  7. setActionCommand(column.getIdentifier().toString());
  8. }
  9. boolean visible = (column instanceof TableColumnExt) ?
  10. ((TableColumnExt) column).isVisible() : true;
  11. updateFromColumnVisible(visible);
  12. }

代码示例来源:origin: com.eas.platypus/platypus-js-grid

  1. public final void setTableColumn(TableColumn aColumn) {
  2. if (tableColumn != null) {
  3. tableColumn.removePropertyChangeListener(columnListener);
  4. }
  5. if (aColumn == null && tableColumn != null) {
  6. minWidth = tableColumn.getMinWidth();
  7. maxWidth = tableColumn.getMaxWidth();
  8. if (tableColumn.getHeaderValue() instanceof String) {
  9. title = (String) tableColumn.getHeaderValue();
  10. }
  11. }
  12. tableColumn = aColumn;
  13. if (tableColumn != null) {
  14. tableColumn.addPropertyChangeListener(columnListener);
  15. }
  16. }

代码示例来源:origin: org.swinglabs.swingx/swingx-all

  1. private void installColumn(TableColumn column) {
  2. this.column = column;
  3. column.addPropertyChangeListener(getColumnListener());
  4. updateFromColumnHeader(column.getHeaderValue());
  5. // #429-swing: actionCommand must be string
  6. if (column.getIdentifier() != null) {
  7. setActionCommand(column.getIdentifier().toString());
  8. }
  9. boolean visible = (column instanceof TableColumnExt) ?
  10. ((TableColumnExt) column).isVisible() : true;
  11. updateFromColumnVisible(visible);
  12. }

代码示例来源:origin: com.haulmont.thirdparty/glazedlists

  1. throw new IllegalStateException("null TableColumn objects are not allowed in EventTableColumnModel");
  2. newColumn.addPropertyChangeListener(this);
  3. fireColumnAdded(new TableColumnModelEvent(this, 0, getColumnCount() - 1));
  4. newColumn.addPropertyChangeListener(this);

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java15

  1. throw new IllegalStateException("null TableColumn objects are not allowed in EventTableColumnModel");
  2. newColumn.addPropertyChangeListener(this);
  3. fireColumnAdded(new TableColumnModelEvent(this, 0, getColumnCount() - 1));
  4. newColumn.addPropertyChangeListener(this);

代码示例来源:origin: com.haulmont.thirdparty/glazedlists

  1. /**
  2. * Creates a new model that contains the {@link TableColumn} objects from
  3. * the given <code>source</code>. Changes to the <code>source</code> are
  4. * reflected in this model.
  5. */
  6. public EventTableColumnModel(EventList<T> source) {
  7. setSelectionModel(createSelectionModel());
  8. setColumnMargin(1);
  9. invalidateWidthCache();
  10. setColumnSelectionAllowed(false);
  11. // lock the source list for reading since we want to prevent writes
  12. // from occurring until we fully initialize this EventTableColumnModel
  13. source.getReadWriteLock().readLock().lock();
  14. try {
  15. // ensure all of the TableColumns are non-null
  16. for (int i = 0, n = source.size(); i < n; i++) {
  17. if (source.get(i) == null)
  18. throw new IllegalStateException("null TableColumn objects are not allowed in EventTableColumnModel");
  19. }
  20. // start listening to each of the TableColumns for property changes that may resize the table header
  21. for (int i = 0, n = source.size(); i < n; i++)
  22. source.get(i).addPropertyChangeListener(this);
  23. disposeSwingThreadSource = !GlazedListsSwing.isSwingThreadProxyList(source);
  24. swingThreadSource = disposeSwingThreadSource ? GlazedListsSwing.swingThreadProxyList(source) : (TransformedList<T, T>) source;
  25. swingThreadSource.addListEventListener(this);
  26. } finally {
  27. source.getReadWriteLock().readLock().unlock();
  28. }
  29. }

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java15

  1. /**
  2. * Creates a new model that contains the {@link TableColumn} objects from
  3. * the given <code>source</code>. Changes to the <code>source</code> are
  4. * reflected in this model.
  5. */
  6. public EventTableColumnModel(EventList<T> source) {
  7. setSelectionModel(createSelectionModel());
  8. setColumnMargin(1);
  9. invalidateWidthCache();
  10. setColumnSelectionAllowed(false);
  11. // lock the source list for reading since we want to prevent writes
  12. // from occurring until we fully initialize this EventTableColumnModel
  13. source.getReadWriteLock().readLock().lock();
  14. try {
  15. // ensure all of the TableColumns are non-null
  16. for (int i = 0, n = source.size(); i < n; i++) {
  17. if (source.get(i) == null)
  18. throw new IllegalStateException("null TableColumn objects are not allowed in EventTableColumnModel");
  19. }
  20. // start listening to each of the TableColumns for property changes that may resize the table header
  21. for (int i = 0, n = source.size(); i < n; i++)
  22. source.get(i).addPropertyChangeListener(this);
  23. disposeSwingThreadSource = !GlazedListsSwing.isSwingThreadProxyList(source);
  24. swingThreadSource = disposeSwingThreadSource ? GlazedListsSwing.swingThreadProxyList(source) : (TransformedList<T, T>) source;
  25. swingThreadSource.addListEventListener(this);
  26. } finally {
  27. source.getReadWriteLock().readLock().unlock();
  28. }
  29. }

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java16

  1. /**
  2. * Creates a new model that contains the {@link TableColumn} objects from
  3. * the given <code>source</code>. Changes to the <code>source</code> are
  4. * reflected in this model.
  5. */
  6. public EventTableColumnModel(EventList<T> source) {
  7. setSelectionModel(createSelectionModel());
  8. setColumnMargin(1);
  9. invalidateWidthCache();
  10. setColumnSelectionAllowed(false);
  11. // lock the source list for reading since we want to prevent writes
  12. // from occurring until we fully initialize this EventTableColumnModel
  13. source.getReadWriteLock().readLock().lock();
  14. try {
  15. // ensure all of the TableColumns are non-null
  16. for (int i = 0, n = source.size(); i < n; i++) {
  17. if (source.get(i) == null)
  18. throw new IllegalStateException("null TableColumn objects are not allowed in EventTableColumnModel");
  19. }
  20. // start listening to each of the TableColumns for property changes that may resize the table header
  21. for (int i = 0, n = source.size(); i < n; i++)
  22. source.get(i).addPropertyChangeListener(this);
  23. disposeSwingThreadSource = !GlazedListsSwing.isSwingThreadProxyList(source);
  24. swingThreadSource = disposeSwingThreadSource ? GlazedListsSwing.swingThreadProxyList(source) : (TransformedList<T, T>) source;
  25. swingThreadSource.addListEventListener(this);
  26. } finally {
  27. source.getReadWriteLock().readLock().unlock();
  28. }
  29. }

相关文章