String[][] data= new String[][] { {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "VIEW BUTTON"}, {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "VIEW BUTTON"}}; String[] col = new String[] { "Last Name", "First Name", "Middle Initial", "Phone Number", "Email", "Project Title", "Project Description", "Amount", "Date Approved", "Date Completed", "College", "Faculty Mentor Name", "Co Grantee", "Major", "Travel Required", "Travel Purpose", "Travel Cost", "Travel Start Date", "Travel End Date", "View"}; JXTable table = new JXTable(data,col); table.setVisibleColumnCount(10); table.setHorizontalScrollEnabled(true); JScrollPane pane = new JScrollPane(table); JComponent comp = new JPanel(new BorderLayout()); comp.add(pane);
/** Creates new form DefaultMapLayerTablePanel */ public LayerFeaturePropertyPanel() { //netbeans JPanel components init initComponents(); tab_data.setDefaultRenderer(Geometry.class, new GeometryCellRenderer()); tab_data.setDefaultEditor(Geometry.class, new GeometryCellEditor()); tab_data.setEditable(false); tab_data.setColumnControlVisible(true); tab_data.setHorizontalScrollEnabled(true); tab_data.setAutoResizeMode(JXTable.AUTO_RESIZE_OFF); tab_data.setHighlighters(new Highlighter[]{HighlighterFactory.createAlternateStriping(Color.white, HighlighterFactory.QUICKSILVER, 5)}); tab_data.setShowGrid(true, true); tab_data.setGridColor(Color.GRAY.brighter()); SwingUtilities.invokeLater(new Runnable() { public void run() { tab_data.packAll(); } }); jcb_collection.addItem(BUNDLE.getString("filter")); jcb_collection.addItem(BUNDLE.getString("all")); }
public GlobalExcludeURLMultipleOptionsPanel(OptionsGlobalExcludeURLTableModel model) { super(model); this.model = model; getTable().getColumnExt(0).setPreferredWidth(25); // checkbox column should be tiny getTable().getColumnExt(1).setPreferredWidth(350); // wide Desc Col getTable().getColumnExt(2).setPreferredWidth(300); // less wide Regex Column getTable().setHorizontalScrollEnabled(true); // descriptions / regexs are very wide, so turn on horiz scroll getTable().setAutoCreateRowSorter(true); getTable().setSortOrder(1, SortOrder.ASCENDING); // sort by description by default /* XXX For some reason, sorting isn't accurate in the table. The getColumnClass correctly returns String for the Description, but sort order might be: "Ext - MS Word, ExtParam - Bla bla, Ext - PDF." It is like string.compare for the column sort ignores the space and dash. Really unsure as to why. As a work-around, start some descriptions with "Extension" instead of the shorter "Ext" */ }