jtable, defaulttable model

hello how can i remove column in JTable

i have already made a button that when triggered it will add column through

DefaultTableModel tbl = new DefaultTableModer():


now what im trying to do is make a column vanish T T and im surprised i did not see a removeColumn method xD is there anyway i can remove columns through runtime

and if JTable.remove(component) is the answer how how can i use it xD

Posted On: Monday 24th of September 2012 04:51:22 AM Total Views:  285
View Complete with Replies

Related Messages:

create a jtable which can combine and split and the image change also   (266 Views)
hi newbie here and would like to know how to create a jtable with default images and with specific column and rows that if you combine the cells the image enlarge and when split the image decreases.
JTable doesn't show new model after adding new row   (205 Views)
I can't repaint my jTable. I must re-run all application to show addRow. This is the code: public class Mainpage2 extends javax.swing.JFrame { public static DefaultTableModel tripModel; /** * Creates new form carpoolingui */ public Mainpage2(){ try { tripModel = MPtable.myModel(Parser.parsa_tratta(Database.doRequest("SELECT * from tratte"))); } catch (Exception ex) { Logger.getLogger(Mainpage2.class.getName()).log(Level.SEVERE, null, ex); } initComponents(); } .... jTable1.setModel(tripModel); .... public void tripRepaint() throws MalformedURLException, Exception{ System.out.println(jTable1.getModel()); tripModel = MPtable.myModel(Parser.parsa_tratta(Database.doRequest("SELECT * from tratte"))); jTable1.setModel(tripModel); jTable1.repaint(); System.out.println(jTable1.getModel()); System.out.println(tripModel);
Implement AbstractTableModel Tablemodel Jtable   (148 Views)
wise coders!.would you mind helping me this time . i'm working on tables so i'm reading java tutorials and i want to implement my own model as oracle recomend in this link Implement AbsctractTableModel. the trouble is that i need my own data and columnames provided by a resultset BUT i cant set the results to this new implementation of abstracttablemodel returns me the following error . i've tried the following: at the enclosing class for setting the column names and data private int numeroderesultados; private MYOWNCUSTOMMODEL CUSTOMMODEL; private static String[] columnNames; private static Object[][] data; public static void ModeloDeCobroInicial1(java.sql.ResultSet DatosdeModelo, String ColNames[], int ResultsetRows) { String col[] = new String[ColNames.length]; columnNames = new String[ColNames.length]; System.arraycopy(ColNames, 0, InicioCobro.columnNames, 0, ColNames.length); = new String[ResultsetRows][ColNames.length]; try { int i = 0; while ( { for (int j = 0; j
Creating a model for a JTable using Vectors   (120 Views)
I have a class called ContactDAOImpl
HELP on JTABLE and table model   (115 Views)
i need help on clearing tables i want to clear the tables then get all the elements from JDBC again just like what it does on form load the problem is when i clear it which i did. but whenever i call the upTable it loads 6 columns instead of just three this method is triggered by a button while(tblRecords.getColumnModel().getColumnCount() > 0) { tblRecords.removeColumn(tblRecords.getColumnModel().getColumn(0)); } while(mtblRecord.getRowCount() > 0) { mtblRecord.removeRow(0); } upTable(); private void upTable() { try { for(int x = 0 ; x < rm.getColumnCount()-1; x++) { mtblRecord.addColumn(rm.getColumnName(x+1).replace("EX_", " ").trim()); } rs.beforeFirst(); while( { usErs usO = new usErs(rs.getString("EX_ID"),rs.getString("EX_USER"),rs.getString("EX_POSITION")); mtblRecord.addRow(new Object[] {,usO.User(),usO.Position()}); } } catch(SQLException err) { JOptionPane.showMessageDialog(frmLog.this, err.getMessage()); } }