private void init_tbl_branch_locations() { tbl_branch_locations_ALM = new ArrayListModel(); tbl_branch_locations_M = new Tblbranch_locationsModel(tbl_branch_locations_ALM); tbl_branch_locations.getTableHeader().setPreferredSize(new Dimension(100, 40)); tbl_branch_locations.setModel(tbl_branch_locations_M); tbl_branch_locations.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); tbl_branch_locations.setRowHeight(25); int[] tbl_widths_branch_locations = {200, 200, 70, 0, 0, 0}; for (int i = 0, n = tbl_widths_branch_locations.length; i < n; i++) { if (i == 0) { continue; } TableWidthUtilities.setColumnWidth(tbl_branch_locations, i, tbl_widths_branch_locations[i]); } Dimension d = tbl_branch_locations.getTableHeader().getPreferredSize(); d.height = 25; tbl_branch_locations.getTableHeader().setPreferredSize(d); tbl_branch_locations.getTableHeader().setFont(new java.awt.Font("Arial", 0, 11)); tbl_branch_locations.setRowHeight(25); tbl_branch_locations.setFont(new java.awt.Font("Arial", 0, 11)); }
/** * Creates new form FortfuehrungsanlaesseDialog. * * @param parent DOCUMENT ME! * @param modal DOCUMENT ME! */ private FortfuehrungsanlaesseDialog(final Frame parent, final boolean modal) { super(parent, modal); initComponents(); final Highlighter istAbgearbeitetHighlighter = new IstAbgearbeitetHighlighter(); jXTable1.setHighlighters(istAbgearbeitetHighlighter); jXTable1.setModel(new FortfuehrungenTableModel()); jXTable1 .getColumnModel() .getColumn(0) .setCellRenderer(jXTable1.getDefaultRenderer(String.class)); jXTable1 .getColumnModel() .getColumn(1) .setCellRenderer(jXTable1.getDefaultRenderer(String.class)); jXTable1 .getColumnModel() .getColumn(2) .setCellRenderer(jXTable1.getDefaultRenderer(String.class)); jXTable1.getColumnModel().getColumn(0).setPreferredWidth(100); jXTable1.getColumnModel().getColumn(1).setPreferredWidth(150); jXTable1.getColumnModel().getColumn(2).setPreferredWidth(200); jXTable1.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jXTable1.setDragEnabled(false); jXTable1.getTableHeader().setResizingAllowed(true); jXTable1.getTableHeader().setReorderingAllowed(false); // jXTable1.setSortOrder(1, SortOrder.ASCENDING); jXTable1 .getSelectionModel() .addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent e) { // If cell selection is enabled, both row and column change events are fired if ((e.getSource() == jXTable1.getSelectionModel()) && jXTable1.getRowSelectionAllowed()) { fortfuehrungsTableListSelectionChanged(e); } } }); jProgressBar1.setVisible(false); }
private void configureDayOfWeeksHeader(JXTable table) { table.getTableHeader().setDefaultRenderer(createMonthHeaderRenderer()); table.getTableHeader().setResizingAllowed(false); table.getTableHeader().setReorderingAllowed(false); table.getTableHeader().setBorder(underlineBorder); }