List of usage examples for javax.swing.table TableColumn setMaxWidth
@BeanProperty(description = "The maximum width of the column.") public void setMaxWidth(int maxWidth)
TableColumn
's maximum width to maxWidth
or, if maxWidth
is less than the minimum width, to the minimum width. From source file:org.zaproxy.zap.extension.httppanel.view.paramtable.HttpPanelParamTableView.java
@Override public void setEditable(boolean editable) { if (isEditable != editable) { if (isEditable) { table.getColumnModel().removeColumn(table.getColumnModel().getColumn(3)); } else {//from www. jav a 2 s. co m TableColumn column = new TableColumn(3, 150, new ComboBoxCellRenderer(comboBoxAddIns), new DefaultCellEditor(comboBoxAddIns)); column.setPreferredWidth(150); column.setMaxWidth(150); table.addColumn(column); } isEditable = editable; httpPanelTabularModel.setEditable(editable); } }
From source file:org.zaproxy.zap.extension.httppanelviews.paramtable.HttpPanelParamTableView.java
private void init() { // Table/* www . j ava2s . 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(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:pcgen.gui2.tabs.CompanionInfoTab.java
private void initComponents() { {/*from www . ja v a2 s .c o m*/ DefaultTableColumnModel model = new DefaultTableColumnModel(); TableColumn column = new TableColumn(0); column.setResizable(true); model.addColumn(column); column = new TableColumn(1, 120, new ButtonCellRenderer(), null); column.setMaxWidth(120); column.setResizable(false); model.addColumn(column); companionsTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); companionsTable.getTableHeader().setResizingAllowed(false); companionsTable.setAutoCreateColumnsFromModel(false); companionsTable.setColumnModel(model); } companionsTable.setIntercellSpacing(new Dimension(0, 0)); companionsTable.setFocusable(false); companionsTable.setRowHeight(23); companionsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); setLeftComponent(new JScrollPane(companionsTable)); JPanel rightPane = new JPanel(new BorderLayout()); infoPane.setOpaque(false); infoPane.setEditable(false); infoPane.setFocusable(true); infoPane.setContentType("text/html"); //$NON-NLS-1$ rightPane.add(new JScrollPane(infoPane), BorderLayout.CENTER); JPanel buttonPane = new JPanel(new FlowLayout()); buttonPane.add(loadButton); rightPane.add(buttonPane, BorderLayout.SOUTH); setRightComponent(rightPane); }