001package jmri.jmrix.openlcb.swing.tie; 002 003import java.util.ResourceBundle; 004import javax.swing.BoxLayout; 005import javax.swing.JPanel; 006import javax.swing.JScrollPane; 007import javax.swing.JTable; 008import javax.swing.table.TableColumn; 009import javax.swing.table.TableColumnModel; 010import javax.swing.table.TableRowSorter; 011 012/** 013 * Pane for showing the producer table 014 * 015 * @author Bob Jacobsen 2008 016 * @since 2.3.7 017 */ 018public class ProducerTablePane extends JPanel { 019 020 static ResourceBundle rb = ResourceBundle.getBundle("jmri.jmrix.openlcb.swing.tie.TieBundle"); 021 022 protected JTable table = null; 023 protected ProducerTableModel tableModel = null; 024 025 public void initComponents() { 026 027 // set the frame's initial state 028 setSize(500, 300); 029 setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); 030 031 tableModel = new ProducerTableModel(); 032 table = new JTable(tableModel); 033 table.setRowSorter(new TableRowSorter<>(tableModel)); 034 table.setRowSelectionAllowed(true); 035 table.setPreferredScrollableViewportSize(new java.awt.Dimension(300, 350)); 036 037 TableColumnModel columnModel = table.getColumnModel(); 038 TableColumn column; 039 column = columnModel.getColumn(ProducerTableModel.USERNAME_COLUMN); 040 column.setMinWidth(20); 041 //column.setMaxWidth(40); 042 column.setResizable(true); 043 column = columnModel.getColumn(ProducerTableModel.NODE_COLUMN); 044 column.setMinWidth(40); 045 //column.setMaxWidth(85); 046 column.setResizable(true); 047 column = columnModel.getColumn(ProducerTableModel.NUMBER_COLUMN); 048 column.setMinWidth(75); 049 //column.setMaxWidth(100); 050 column.setResizable(true); 051 JScrollPane scrollPane = new JScrollPane(table); 052 add(scrollPane); 053 } 054 055}