List of usage examples for javax.swing.table TableColumn setWidth
@BeanProperty(description = "The width of the column.") public void setWidth(int width)
JTable
, use setPreferredWidth
instead. From source file:org.zaproxy.zap.extension.httppanel.view.paramtable.HttpPanelParamTableView.java
private void init() { // Table//from ww w. ja v a 2 s . c o m table = new JTable(); table.setName(""); table.setModel(httpPanelTabularModel); table.setGridColor(java.awt.Color.gray); table.setIntercellSpacing(new java.awt.Dimension(1, 1)); table.setRowHeight(DisplayUtils.getScaledSize(18)); // Issue 954: Force the JTable cell to auto-save when the focus changes. // Example, edit cell, click OK for a panel dialog box, the data will get saved. table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); // Set standard row width's TableColumn column = table.getColumnModel().getColumn(0); column.setPreferredWidth(70); column.setWidth(70); column.setMaxWidth(70); if (table.getColumnCount() == 4) { column = table.getColumnModel().getColumn(3); column.setPreferredWidth(150); column.setWidth(150); column.setMaxWidth(150); } // Main panel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(new JScrollPane(table), BorderLayout.CENTER); }
From source file:org.zaproxy.zap.extension.httppanelviews.paramtable.HttpPanelParamTableView.java
private void init() { // Table//from w w w . ja va 2s .co m table = new JTable(); table.setName(""); table.setModel(httpPanelTabularModel); table.setGridColor(java.awt.Color.gray); table.setIntercellSpacing(new java.awt.Dimension(1, 1)); table.setRowHeight(18); // Set standard row width's TableColumn column = table.getColumnModel().getColumn(0); column.setPreferredWidth(70); column.setWidth(70); column.setMaxWidth(70); if (table.getColumnCount() == 4) { column = table.getColumnModel().getColumn(3); column.setPreferredWidth(150); column.setWidth(150); column.setMaxWidth(150); } // Main panel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(new JScrollPane(table), BorderLayout.CENTER); }
From source file:pipeline.GUI_utils.JXTablePerColumnFiltering.java
public JXTablePerColumnFiltering(TableModel model) { super(model); this.model = (BeanTableModel<?>) model; // Create the 1-row filtering Table nColumns = model.getColumnCount();// w ww .j av a 2 s . co m // DependencyEngine e = new DependencyEngine(new BasicEngineProvider()); for (int row = 0; row < model.getRowCount(); row++) { for (int i = 0; i < nColumns; i++) { if (getColumnName(i).contains("userCell")) { // this is a column with cells that can contain formulas in addition to computed values } else { } } } filteringModel = new DefaultTableModel(1, nColumns); initializeFilterModel(); filteringTable = new JXTableBetterFocus(filteringModel); filteringTable.setTableHeader(null); for (int i = 0; i < nColumns; i++) { TableColumn fColumn = filteringTable.getColumn(i); MultiRenderer multiRenderer = getMultiRenderer(); fColumn.setCellRenderer(multiRenderer); fColumn.setCellEditor(multiRenderer); fColumn.setWidth(getColumn(i).getWidth()); } this.setRowFilter(filter); JTableHeader header = this.getTableHeader(); if (tips == null) { tips = new ColumnHeaderToolTips(); } header.addMouseMotionListener(tips); }