List of usage examples for javax.swing.table DefaultTableCellRenderer setHorizontalAlignment
@BeanProperty(visualUpdate = true, enumerationValues = { "SwingConstants.LEFT", "SwingConstants.CENTER", "SwingConstants.RIGHT", "SwingConstants.LEADING", "SwingConstants.TRAILING" }, description = "The alignment of the label's content along the X axis.") public void setHorizontalAlignment(int alignment)
From source file:org.zaproxy.zap.extension.ascan.ScanProgressDialog.java
/** * Get the main content panel of the dialog * @return the main panel/*from w w w . j av a 2s . c om*/ */ private JTable getMainPanel() { if (table == null) { model = new ScanProgressTableModel(); table = new JTable(); table.setModel(model); table.setRowSelectionAllowed(false); table.setColumnSelectionAllowed(false); table.setDoubleBuffered(true); // First column is for plugin's name table.getColumnModel().getColumn(0).setPreferredWidth(256); table.getColumnModel().getColumn(1).setPreferredWidth(80); // Second column is for plugin's status table.getColumnModel().getColumn(2).setPreferredWidth(80); table.getColumnModel().getColumn(2).setCellRenderer(new ScanProgressBarRenderer()); // Third column is for plugin's elapsed time DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer(); centerRenderer.setHorizontalAlignment(JLabel.CENTER); table.getColumnModel().getColumn(3).setPreferredWidth(85); table.getColumnModel().getColumn(3).setCellRenderer(centerRenderer); // Forth column is for plugin's request count DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer(); rightRenderer.setHorizontalAlignment(JLabel.RIGHT); table.getColumnModel().getColumn(4).setPreferredWidth(60); table.getColumnModel().getColumn(4).setCellRenderer(rightRenderer); // Fifth column is for plugin's completion and actions table.getColumnModel().getColumn(5).setPreferredWidth(40); table.getColumnModel().getColumn(5).setCellRenderer(new ScanProgressActionRenderer()); ScanProgressActionListener listener = new ScanProgressActionListener(table); table.addMouseListener(listener); table.addMouseMotionListener(listener); } return table; }
From source file:nl.phanos.liteliveresultsclient.gui.ResultsWindows.java
private void initCustumComponents() { logoLabel = new javax.swing.JLabel(); icon = new ImageIcon(getCLub()); logoLabel.setIcon(icon); // NOI18N logoLabel.setBounds(this.getWidth() - icon.getIconWidth(), this.getHeight() - icon.getIconHeight(), icon.getIconWidth(), icon.getIconHeight()); LayerdPane.add(logoLabel, JLayeredPane.PALETTE_LAYER); clockLabel = new javax.swing.JLabel(); clockLabel.setFont(new java.awt.Font("Lucida Grande", 0, fontSize)); // NOI18N clockLabel.setText(""); clockLabel.setForeground(Color.YELLOW); LayerdPane.add(clockLabel, JLayeredPane.PALETTE_LAYER); jTable1.setRowSelectionAllowed(false); jTable1.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {}, new String[] { "Plaats", "Atleet", "Tijd" }) { Class[] types = new Class[] { java.lang.Integer.class, java.lang.String.class, java.lang.String.class }; boolean[] canEdit = new boolean[] { false, false, false }; public Class getColumnClass(int columnIndex) { return types[columnIndex]; }//from w ww . j a v a 2 s .c o m public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit[columnIndex]; } }); jScrollPane1.getViewport().setBackground(Color.black); this.setBackground(Color.black); JTableHeader header = jTable1.getTableHeader(); header.setOpaque(false); jPanel1.setBackground(Color.black); header.setBackground(Color.black); header.setForeground(Color.YELLOW); DefaultTableCellRenderer headerRenderer = new DefaultTableCellRenderer(); headerRenderer.setBackground(Color.BLACK); for (int i = 0; i < jTable1.getModel().getColumnCount(); i++) { if (jTable1.getModel().getColumnCount() > 0) { jTable1.getColumnModel().getColumn(i).setHeaderRenderer(headerRenderer); } } DefaultTableCellRenderer LEFTRenderer = new DefaultTableCellRenderer(); LEFTRenderer.setHorizontalAlignment(JLabel.LEFT); jTable1.getColumnModel().getColumn(0).setCellRenderer(LEFTRenderer); ChangeFont(fontSize); }
From source file:org.zaproxy.zap.extension.customFire.ScanProgressDialog.java
/** * Get the main content panel of the dialog * @return the main panel/*from ww w . j ava 2 s. c o m*/ */ private JTable getMainPanel() { if (table == null) { model = new ScanProgressTableModel(); table = new JTable(); table.setModel(model); table.setRowSelectionAllowed(false); table.setColumnSelectionAllowed(false); table.setDoubleBuffered(true); // First column is for plugin's name table.getColumnModel().getColumn(0).setPreferredWidth(256); table.getColumnModel().getColumn(1).setPreferredWidth(80); // Second column is for plugin's status table.getColumnModel().getColumn(2).setPreferredWidth(80); table.getColumnModel().getColumn(2).setCellRenderer(new ScanProgressBarRenderer()); // Third column is for plugin's elapsed time DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer(); centerRenderer.setHorizontalAlignment(JLabel.CENTER); table.getColumnModel().getColumn(3).setPreferredWidth(85); table.getColumnModel().getColumn(3).setCellRenderer(centerRenderer); // Forth column is for plugin's request count DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer(); rightRenderer.setHorizontalAlignment(JLabel.RIGHT); table.getColumnModel().getColumn(4).setPreferredWidth(60); table.getColumnModel().getColumn(4).setCellRenderer(rightRenderer); // Fifth column is for plugin's completion and actions table.getColumnModel().getColumn(5).setPreferredWidth(40); table.getColumnModel().getColumn(5).setCellRenderer(new ScanProgressActionRenderer()); ScanProgressActionListener listener = new ScanProgressActionListener(table); table.addMouseListener(listener); table.addMouseMotionListener(listener); } return table; }
From source file:cn.labthink.ReadAccess060.java
private void jButton_OpenfileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_OpenfileActionPerformed //filter/*from w ww.java 2s . c o m*/ ExtensionFileFilter filter = new ExtensionFileFilter("mdb", false, true); filter.setDescription("Open DataBase File"); //? JFileChooser jfc = new JFileChooser(); FileSystemView fsv = FileSystemView.getFileSystemView(); //? jfc.setCurrentDirectory(fsv.getHomeDirectory()); jfc.setDialogTitle("Choose the mdb file"); jfc.setMultiSelectionEnabled(false); jfc.setDialogType(JFileChooser.OPEN_DIALOG); jfc.setFileSelectionMode(JFileChooser.FILES_ONLY); jfc.setFileFilter(filter); int result = jfc.showOpenDialog(this); // ""? if (result == JFileChooser.APPROVE_OPTION) { String filesrc = jfc.getSelectedFile().getAbsolutePath(); inputfile = jfc.getSelectedFile(); jLabel_dbpath.setText("DB File Path:" + filesrc); maxid = Integer.MIN_VALUE; minid = Integer.MAX_VALUE; } else { return; } // Infodata = new Vector(); Infocolumns = new Vector(); try { // String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D://b.MDB"; if (inputfile == null) { return; } initDB(); sql = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = sql.executeQuery("SELECT * FROM test order by testid desc"); Infocolumns.add("TestID"); Infocolumns.add("TestType"); Infocolumns.add("DeviceID"); Infocolumns.add("CellID"); Infocolumns.add("Operator"); Infocolumns.add("StartTime"); Infocolumns.add("EndTime"); Infocolumns.add("Comments"); Infocolumns.add("SetTemp."); int columnCount = Infocolumns.size(); Vector row; while (rs.next()) { row = new Vector(columnCount); int temp = 0; int ivalue = rs.getInt("TESTID"); maxid = maxid < ivalue ? ivalue : maxid; minid = minid > ivalue ? ivalue : minid; row.add(ivalue); temp = rs.getInt("TESTTYPE"); if (temp == 1) { row.add("OTR"); } else if (temp == 2) { row.add("WVTR"); } else { row.add(temp); } row.add(rs.getInt("DEVICEID")); row.add(rs.getString("CELLID")); row.add(rs.getString("OPERATOR")); row.add(rs.getDate("STARTTIME")); row.add(rs.getDate("ENDTIME")); row.add(rs.getString("COMMENTS")); row.add(rs.getDouble("SETTEMP")); // row.add(rs.getString(11)); // row.add(rs.getInt(10)); Infodata.add(row); } DefaultTableModel tableModel = new DefaultTableModel(Infodata, Infocolumns); jTable1.setModel(tableModel); //? // jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); jTable1.setSelectionBackground(Color.orange); //? TableRowSorter<TableModel> tableRowSorter = new TableRowSorter<TableModel>(tableModel); jTable1.setRowSorter(tableRowSorter); // jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); //table DefaultTableCellRenderer tcr = new DefaultTableCellRenderer();// table tcr.setHorizontalAlignment(SwingConstants.CENTER);// ?? jTable1.setDefaultRenderer(Object.class, tcr); // ((DefaultTableCellRenderer) jTable1.getTableHeader().getDefaultRenderer()) .setHorizontalAlignment(SwingConstants.CENTER); // DefaultTableCellRenderer rh = new DefaultTableCellRenderer(); // rh.setHorizontalAlignment(SwingConstants.CENTER); // jTable1.getTableHeader().setDefaultRenderer(rh); jTable1.getColumnModel().getColumn(0).setPreferredWidth(20); jTable1.getColumnModel().getColumn(1).setPreferredWidth(28); jTable1.getColumnModel().getColumn(2).setPreferredWidth(20); jTable1.getColumnModel().getColumn(3).setPreferredWidth(40); jTable1.getColumnModel().getColumn(4).setPreferredWidth(40); jTable1.getColumnModel().getColumn(5).setPreferredWidth(100); jTable1.getColumnModel().getColumn(6).setPreferredWidth(100); jTable1.getColumnModel().getColumn(7).setPreferredWidth(100); } catch (SQLException ee) { System.out.println(ee); } catch (ClassNotFoundException ex) { Logger.getLogger(ReadAccess060.class.getName()).log(Level.SEVERE, null, ex); } finally { try { sql.close(); } catch (Exception e) { } try { rs.close(); } catch (Exception e) { } } // validate(); }
From source file:cn.labthink.ReadAccess330.java
private void jButton_OpenfileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_OpenfileActionPerformed //filter/*from w w w. j a va2s . c o m*/ ExtensionFileFilter filter = new ExtensionFileFilter("mdb", false, true); filter.setDescription("Open DataBase File"); //? JFileChooser jfc = new JFileChooser(); FileSystemView fsv = FileSystemView.getFileSystemView(); //? jfc.setCurrentDirectory(fsv.getHomeDirectory()); jfc.setDialogTitle("Choose the mdb file"); jfc.setMultiSelectionEnabled(false); jfc.setDialogType(JFileChooser.OPEN_DIALOG); jfc.setFileSelectionMode(JFileChooser.FILES_ONLY); jfc.setFileFilter(filter); int result = jfc.showOpenDialog(this); // ""? if (result == JFileChooser.APPROVE_OPTION) { String filesrc = jfc.getSelectedFile().getAbsolutePath(); inputfile = jfc.getSelectedFile(); jLabel_dbpath.setText("DB File Path:" + filesrc); maxid = Integer.MIN_VALUE; minid = Integer.MAX_VALUE; } else { return; } // Infodata = new Vector(); Infocolumns = new Vector(); try { // String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D://b.MDB"; if (inputfile == null) { return; } initDB(); sql = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = sql.executeQuery("SELECT * FROM test order by testid desc"); Infocolumns.add("TestID"); Infocolumns.add("TestType"); Infocolumns.add("DeviceID"); Infocolumns.add("CellID"); Infocolumns.add("Operator"); Infocolumns.add("StartTime"); Infocolumns.add("EndTime"); Infocolumns.add("Comments"); Infocolumns.add("SetTemp."); int columnCount = Infocolumns.size(); Vector row; while (rs.next()) { row = new Vector(columnCount); int temp = 0; int ivalue = rs.getInt("TESTID"); maxid = maxid < ivalue ? ivalue : maxid; minid = minid > ivalue ? ivalue : minid; row.add(ivalue); temp = rs.getInt("TESTTYPE"); if (temp == 1) { row.add("OTR"); } else if (temp == 2) { row.add("WVTR"); } else { row.add(temp); } row.add(rs.getInt("DEVICEID")); row.add(rs.getString("CELLID")); row.add(rs.getString("OPERATOR")); row.add(rs.getDate("STARTTIME")); row.add(rs.getDate("ENDTIME")); row.add(rs.getString("COMMENTS")); row.add(rs.getDouble("SETTEMP")); // row.add(rs.getString(11)); // row.add(rs.getInt(10)); Infodata.add(row); } DefaultTableModel tableModel = new DefaultTableModel(Infodata, Infocolumns); jTable1.setModel(tableModel); //? // jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); jTable1.setSelectionBackground(Color.orange); //? TableRowSorter<TableModel> tableRowSorter = new TableRowSorter<TableModel>(tableModel); jTable1.setRowSorter(tableRowSorter); // jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); //table DefaultTableCellRenderer tcr = new DefaultTableCellRenderer();// table tcr.setHorizontalAlignment(SwingConstants.CENTER);// ?? jTable1.setDefaultRenderer(Object.class, tcr); // ((DefaultTableCellRenderer) jTable1.getTableHeader().getDefaultRenderer()) .setHorizontalAlignment(SwingConstants.CENTER); // DefaultTableCellRenderer rh = new DefaultTableCellRenderer(); // rh.setHorizontalAlignment(SwingConstants.CENTER); // jTable1.getTableHeader().setDefaultRenderer(rh); jTable1.getColumnModel().getColumn(0).setPreferredWidth(20); jTable1.getColumnModel().getColumn(1).setPreferredWidth(28); jTable1.getColumnModel().getColumn(2).setPreferredWidth(20); jTable1.getColumnModel().getColumn(3).setPreferredWidth(40); jTable1.getColumnModel().getColumn(4).setPreferredWidth(40); jTable1.getColumnModel().getColumn(5).setPreferredWidth(100); jTable1.getColumnModel().getColumn(6).setPreferredWidth(100); jTable1.getColumnModel().getColumn(7).setPreferredWidth(100); } catch (SQLException ee) { System.out.println(ee); } catch (ClassNotFoundException ex) { Logger.getLogger(ReadAccess330.class.getName()).log(Level.SEVERE, null, ex); } finally { try { sql.close(); } catch (Exception e) { } try { rs.close(); } catch (Exception e) { } } // validate(); }
From source file:org.pgptool.gui.ui.mainframe.MainFrameView.java
private void adjustColumnsWidths() { DefaultTableCellRenderer leftRenderer = new DefaultTableCellRenderer(); leftRenderer.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); leftRenderer.setHorizontalAlignment(JLabel.LEFT); adjustColumn(leftRenderer, DecryptedFilesModel.COLUMN_ENCRYPTED_FILE, 50, leftRenderer); adjustColumn(leftRenderer, DecryptedFilesModel.COLUMN_DECRYPTED_FILE, 50, leftRenderer); }
From source file:com.diversityarrays.kdxplore.trials.SampleGroupViewer.java
private SampleGroupViewer(String title, KdxploreDatabase kdxdb, Trial trial, SampleGroup sampleGroup) { super(new BorderLayout()); this.title = title; // setDefaultCloseOperation(DISPOSE_ON_CLOSE); this.kdxdb = kdxdb; this.trial = trial; this.sampleGroup = sampleGroup; initialise();// w w w.ja v a 2s.c o m if (plotInfoByPlotId.isEmpty()) { add(new JLabel("No Plots available"), BorderLayout.CENTER); } else { tiChoiceTableModel = new TraitInstanceChoiceTableModel(); JTable tiTable = new JTable(tiChoiceTableModel); tiTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { List<Integer> modelRows = GuiUtil.getSelectedModelRows(tiTable); if (modelRows.isEmpty()) { Point pt = e.getPoint(); int vrow = tiTable.rowAtPoint(pt); if (vrow >= 0) { int mrow = tiTable.convertRowIndexToModel(vrow); if (mrow >= 0) { showPopupMenu(tiTable, pt, Arrays.asList(Integer.valueOf(mrow))); } } } else { showPopupMenu(tiTable, e.getPoint(), modelRows); } } } }); tableModel = new DataTableModel(plotInfoByPlotId); JTable table = new JTable(tableModel); DefaultTableCellRenderer r = new DefaultTableCellRenderer(); r.setHorizontalAlignment(SwingConstants.CENTER); table.setDefaultRenderer(String.class, r); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(tiTable), new JScrollPane(table)); splitPane.setResizeWeight(0.2); add(splitPane, BorderLayout.CENTER); table.setTransferHandler(TableTransferHandler.initialiseForCopySelectAll(table, true)); } }
From source file:br.com.postalis.folhapgto.proc.TelaPrincipal.java
private void preencherTabela() { JTableRenderer render = new JTableRenderer(); render.setHorizontalAlignment(SwingConstants.CENTER); DefaultTableCellRenderer centralizar = new DefaultTableCellRenderer(); centralizar.setHorizontalAlignment(SwingConstants.CENTER); ((DefaultTableCellRenderer) tabelaEnvios.getTableHeader().getDefaultRenderer()) .setHorizontalAlignment(SwingConstants.CENTER); tabelaEnvios.getColumnModel().getColumn(0).setCellRenderer(centralizar); tabelaEnvios.getColumnModel().getColumn(1).setCellRenderer(centralizar); tabelaEnvios.getColumnModel().getColumn(2).setCellRenderer(centralizar); tabelaEnvios.getColumnModel().getColumn(3).setCellRenderer(centralizar); tabelaEnvios.getColumnModel().getColumn(4).setCellRenderer(centralizar); tabelaEnvios.getColumnModel().getColumn(5).setCellRenderer(centralizar); tabelaEnvios.getColumnModel().getColumn(6).setCellRenderer(render); // tabelaEnvios.getColumnModel().getColumn(7).setCellRenderer(render); DefaultTableModel modelo = (DefaultTableModel) tabelaEnvios.getModel(); modelo.setNumRows(0);/*from www . ja v a 2s .c o m*/ try { Icon log = new ImageIcon(getClass().getResource("/imagens/notas_20x20.png")); //Icon criticas = new ImageIcon(getClass().getResource("/imagens/alerta_20x20.png")); SimpleDateFormat formatComHora = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); SimpleDateFormat formatSemHora = new SimpleDateFormat("dd-MM-yyyy"); //modelo.addRow(new Object[]{1,formatSemHora.format(DateTime.now().toDate()),formatComHora.format(DateTime.now().toDate()), "JONATHAN", //formatComHora.format(DateTime.now().toDate()), "JONATHAN", log, criticas }); for (PosGpxConsignacaoPopulisControle cp : svc.buscarHistoricoProcessamento()) { ; modelo.addRow(new Object[] { cp.getSqControle(), formatSemHora.format(cp.getDtReferencia()), cp.getDtExportacao() == null ? "" : formatComHora.format(cp.getDtExportacao()), cp.getCdUserExportacao(), cp.getDtImportacao() == null ? "" : formatComHora.format(cp.getDtImportacao()), cp.getCdUserImportacao(), log }); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Erro ao carregar a tabela de envios!!!", "Mensagem de erro", JOptionPane.OK_OPTION); } }
From source file:com.iucosoft.eavertizare.gui.MainJFrame.java
private void initModes() { jListFirma.setModel(firmeListModel); jListFirma.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jListFirma.addMouseListener(mouseListenerList); jTableClients.setModel(clientiTableModel); jTableClients.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // jTableClients.addMouseListener(mouseListenerTable); jTableClients.getColumnModel().getColumn(0).setPreferredWidth(27); jTableClients.getColumnModel().getColumn(7).setPreferredWidth(1); jTableClients.getColumnModel().getColumn(7).setCellRenderer(new MyImageRenderer()); jTableClients.setBackground(new Color(220, 220, 220)); jListFirma.setBackground(new Color(220, 220, 220)); DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer(); centerRenderer.setHorizontalAlignment(JLabel.CENTER); jTableClients.getColumnModel().getColumn(0).setCellRenderer(centerRenderer); jTableClients.getColumnModel().getColumn(5).setCellRenderer(centerRenderer); refreshFrame();//from w ww .j a v a 2 s . c om }
From source file:gda.gui.BatonPanel.java
private void initGUI() { try {//from w w w. ja va 2 s. c om { BorderLayout thisLayout = new BorderLayout(); this.setLayout(thisLayout); this.setPreferredSize(new java.awt.Dimension(902, 431)); } { JPanel jPanel1 = new JPanel(); this.add(jPanel1, BorderLayout.WEST); this.add(getPnlMessages(), BorderLayout.CENTER); jPanel1.setLayout(null); jPanel1.setPreferredSize(new java.awt.Dimension(480, 419)); { sudoPanel = new JPanel(); BorderLayout sudoPanelLayout = new BorderLayout(); sudoPanel.setLayout(sudoPanelLayout); jPanel1.add(sudoPanel); sudoPanel.add(getPnlSudoButtons(), BorderLayout.CENTER); sudoPanel.add(getPnlSUMessage(), BorderLayout.NORTH); sudoPanel.setBorder(BorderFactory.createTitledBorder("Switch User")); sudoPanel.setBounds(12, 340, 456, 80); } { otherClientPanel = new JPanel(); jPanel1.add(otherClientPanel); otherClientPanel.setBorder(BorderFactory.createTitledBorder("Clients on this beamline")); otherClientPanel.setBounds(12, 15, 456, 215); otherClientPanel.setLayout(null); { lblUser = new JLabel(); otherClientPanel.add(lblUser); lblUser.setText("You are logged in as: abc123"); lblUser.setBounds(15, 36, 422, 14); lblUser.setHorizontalAlignment(SwingConstants.CENTER); lblUser.setHorizontalTextPosition(SwingConstants.CENTER); } { lblBaton = new JLabel(); otherClientPanel.add(lblBaton); lblBaton.setText("You hold the baton and have control of the beamline"); lblBaton.setBounds(15, 66, 422, 14); lblBaton.setHorizontalTextPosition(SwingConstants.CENTER); lblBaton.setInheritsPopupMenu(false); lblBaton.setHorizontalAlignment(SwingConstants.CENTER); } { JScrollPane jScrollPane1 = new JScrollPane(); otherClientPanel.add(jScrollPane1); jScrollPane1.setBounds(73, 96, 306, 97); { userClients = new JTable(); jScrollPane1.setViewportView(userClients); userClients.setModel(this.new BatonTableModel()); userClients.setAutoCreateRowSorter(true); userClients.setPreferredSize(new java.awt.Dimension(213, 97)); userClients.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); userClients.setColumnSelectionAllowed(false); userClients.getSelectionModel().addListSelectionListener(this); DefaultTableCellRenderer renderer = new DefaultTableCellRenderer(); renderer.setHorizontalAlignment(SwingConstants.CENTER); userClients.getColumnModel().getColumn(0).setCellRenderer(renderer); userClients.getColumnModel().getColumn(1).setCellRenderer(renderer); userClients.getColumnModel().getColumn(2).setCellRenderer(renderer); JTableHeader th = userClients.getTableHeader(); th.addMouseListener(this); } } } { buttonsPanel = new JPanel(); BorderLayout buttonsPanelLayout = new BorderLayout(); buttonsPanel.setLayout(buttonsPanelLayout); jPanel1.add(buttonsPanel); buttonsPanel.setBorder(BorderFactory.createTitledBorder("Baton control")); buttonsPanel.setBounds(12, 242, 456, 92); buttonsPanel.add(getPnlControlButton(), BorderLayout.CENTER); buttonsPanel.add(getPnlTickBox(), BorderLayout.SOUTH); } } } catch (Exception e) { logger.error(e.getMessage(), e); } }