Column validation for JTable?

Hi all,
i have a table on my app, there is a column that show boolean value on the table. it's represented by check box, cause i'm using a custom table model. the datas is took from database.
i want to create a column validation to validate at least only 1 cell must checked, if there's only a checkbox that checked and when we try to uncheck the last one it will show us a warning. how to make it possible?
anyone can help me?
ps:
i'm using jdk1.6.0_04

You will probably need to create a custom editor.
This code shows how to create one using a text field. The code will be similiar for a check box:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=642364
You will need access to the JTable or TableModel and would need to look at the values in every row for the specific column before determining whether to stop editing or not.

Similar Messages

  • Resize column width for JTable without column headers?

    Hi,
    I find that for me to resize columns of a JTable by using
    mouse dragging, I MUST have column headers and then drag
    column headers to resize them. Is my understanding correct?
    Actually, I need to have a table without header columns.
    How can I use mouse to resize column width by dragging?
    The background for this request is that I am putting a
    complex table as another table's column header and I hope to
    be able to resizing the complex table by mouse dragging.
    Thanks very much,
    David

    Hi,
    I think you have mistake there. Try
    <style type="text/css">
    table.apexir_WORKSHEET_DATA td {
    white-space:nowrap !important;
    td[headers="DESCR"] {
    width:300px !important;
    max-width:300px !important;
    #apexir_DESCR {
    width:10px;
    max-width:300px !important;
    </style>And you can try add
    table.apexir_WORKSHEET_DATA {
    width: 100% !important;
    table-layout: fixed !important;
    }Regards,
    Jari
    My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
    Twitter: http://www.twitter.com/jariolai

  • Row level validations for JTable

    Is their a way to validate the row data of a editable JTable before moving out from that row, and if invalid data existings in that row then we need to display an error message and set the focus back to that row.
    Basically the user should not be able to move out from that row until he enters valid data for the row.
    I was able to do the validations at the cell level, by validating in the editor of that particular cell or in the SetValueAt() method. The reason i need the row level validations are for example if a required cell is left blank(if we don't tab into the cell then nor the editor is started nor the setValueAt() is called to do the validations) or if a cell's validation depends on the other cell's value in the same row.
    I can over write the valueChanged() method of the Jtable itself to trap the row change event. But the valueChanged() method only does the repainting for the new selection, the selectedRow index is changed even before the valueChanged is called. So in the valueChanged() method the selectedRow index is the row to which u are moving into rather than the row from which u are moving out and this is the row u need validations for. ListSelectionEvent has two methods getFirstIndex() and getLastIndex(), one among these two will return the row number from which u are moving out from, so based on this i can validate the row iam moving out from and set the focus back to that row if invalid data exists.(The valueChanged event is fired again when u are resetting back the focus).
    But the problem is when the row u are moving into and the row u are moving out from both have invalid data. Then it becomes an infinite loop as the valueChanged event is fired when u are setting back the focus.
    Any Suggestions ?
    Thanks

    DrClap:
    i need a editable JTable. so ur suggestion doesn't work.
    Jaredth :
    here is the code. I have over rided valueChanged method of JTable and called my validateRow in this method. I am just displaying a error msg for now, iam not setting the focus back to the row which has invalidate data. This code doestn't work for cases where when the row u are moving into and the row u are moving out from both have invalid data.
    public void valueChanged(ListSelectionEvent e){
    if( this.getSelectedRow() == -1) return;
    if(!e.getValueIsAdjusting() ) {
    int selRow = this.getSelectedRow();
    int firstIndex = e.getFirstIndex();
    int lastIndex = e.getLastIndex();
    int rowToValidate = selRow == lastIndex ? firstIndex : lastIndex;
    if( !isValidateRow( rowToValidate) ){
    JOptionPane.showMessageDialog(null,"Invalid Data at row: "+rowToValidate,
    "Row validation failed", JOptionPane.ERROR_MESSAGE);
    return;
    kenny_lee:
    I have already done what u explained above. This works fine for cases where u need to validate individual cells in a row. But what happens when the validation of a cell in a row depends on the value in a different cell in the same row and for which u didn't enter any value yet. So in these cases u need to do the validation when u are moving out from the row. So i need to know is their a way to handle this in a efficient way? There is a way by over loading the valueChanged method of the JTable as mentioned above but it will not work for cases where the row u are moving into and the row u are moving out from both have invalid data.
    Thanks for ur response.
    Let me know if u find a solution to this problem

  • Custom column headers for JTable in JScrollPane

    I want a heirachical header structure on a scrolled JTable. I've successfully generated a second JTableHeader which moves it's tabs with the normal header. If I add the secondary JTableHeader into the container above the whole scroll pane it's does almost what I want, but it's not quite correctly aligned.
    What I want to do is to put both the automaticaly generated JTableHeader and my extra one into the JScrollPane's column header area.
    I wrapped the two headers together into a vertical Box and tried calling the setColumnHeaderView() on the scrollpane, and then creating a JViewport and using setColumnHeader(). Niether seems to have any effect. The basic table header obstinately remains unaltered.
    There seems to be some special processing going on when JTable and JScrollPane get together, but I can't understand how replacing the column header viewport can be ineffective.

    Thanks. I think I've just cracked it more thoroughly, though. [I found this bug report|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5032464]. This has guided me to a work-around that seems stable so far. I'm using an extended JTable class anyway (mostly to do with table header width behaviour). I've added a field to my own table class and the following override:
    The trick is to work out where the dirty deed is done, having search all the scroll pane related classes for special casing JTable.
    public class STable extends JTable {
        @Override
        protected void configureEnclosingScrollPane() {
            if (secondaryHeader == null) {
                super.configureEnclosingScrollPane();
            } else {
                Container p = getParent();
                if (p instanceof JViewport) {
                    Container gp = p.getParent();
                    if (gp instanceof JScrollPane) {
                        JScrollPane scrollPane = (JScrollPane) gp;
                        // Make certain we are the viewPort's view and not, for
                        // example, the rowHeaderView of the scrollPane -
                        // an implementor of fixed columns might do this.
                        JViewport viewport = scrollPane.getViewport();
                        if (viewport == null || viewport.getView() != this) {
                            return;
                        JPanel hdrs = new JPanel();
                        hdrs.setLayout(new BorderLayout());
                        hdrs.add(secondaryHeader.getHeader(), BorderLayout.NORTH);
                        hdrs.add(getTableHeader(), BorderLayout.SOUTH);
                        scrollPane.setColumnHeaderView(hdrs);
                        //  scrollPane.getViewport().setBackingStoreEnabled(true);
                        Border border = scrollPane.getBorder();
                        if (border == null || border instanceof UIResource) {
                            Border scrollPaneBorder =
                                    UIManager.getBorder("Table.scrollPaneBorder");
                            if (scrollPaneBorder != null) {
                                scrollPane.setBorder(scrollPaneBorder);
        }I'm hopeful that will prevent the column header view from being overwritten by later layout operations.

  • Setting column names in JTable

    can n e one tell me how to set column names for JTable..
    i don't wanna use the JTable constructor ... cuz
    my column names change...

    this is how i did it once...hope it helps
    Vector columnNames = new Vector();
    JTable previewTable = new JTable();
    previewTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    previewScrollPane.getViewport().add(previewTable, null);
    int colNo = 2; // i am displaying 2 columns
    columnNames.add("Col One");
    columnNames.add("Col Two");
    String[] tableColumnNames = {"Id Name","Type"};
    DefaultTableModel aModel = (DefaultTableModel) previewTable.getModel();
    aModel.setColumnIdentifiers(tableColumnNames);
    //add data to the table
    .//loop
    aModel.addRow(objects);
    previewTable.revalidate();
    previewTable.setModel(aModel);

  • How to fix the value of first column in the JTable in java swing for every

    Hi ,
    I have a swing page that have table panel in which there is a table of size 7x4 now when I click on the perticulat row then that row data will displayin the table like that the selected row become the second column in the new table and the fist column of this table will remain constant for all the entry but the second column update according to the roe which is selected .How it is possible .
    Thanks in Advace,
    anu

    One thing you can do is to prevent the user from editing that column and programatically supply the values of that column yourself.
    JTable table = new JTable() {
       public boolean isCellEditable(int row, int col) {
           if(col == 0) {
              return false;
           return super.isCellEditable(row, col);
    };This allows you to prevent the user from editing the column information so you can supply some sort of a default value for the column always
    ICE

  • Looking for component: flexible rows like columns in a JTable

    Hello,
    I need a swing component to display several rows which can be moved up and down, the height resized, interchanged with the mouse like the columns in a JTable. But there is no need for columns. I think there is no standard swing component.
    Any ideas, resource hints?
    Thanks, Ulrich

    One more piece of advice. It is not very easy to get "pre-written custom components". Most developers do things to meet their own needs and these may not be exactly what you are looking for. The best thing to do is to try to develop this yourself. It will give you loads of experience and in later programmes you may write, based on the experience you obtained from the "pain-staking" development process you'll know how to go round these problems quicker and may be able to help others also.
    So just start writing some stuff. You may end up finishing sooner than you think. And remember forum members are always ready to help with problems (accompanied by minimal code examples of the actual problem).
    ICE

  • Help for adjusting columns of a JTAble in a Table Model

    Hello community,
    In order to have a good display of by DataBase in a JTable, I've wrote some code to adjust columns in function of datas. Those datas are displayed with a TableModel ( which I've declared in a class JDBCAdapter ).
    When I start my application, I call adjustColumns(), and all is great but when I add information to my DB and display it, the columns of my JTable return to default width...
    So I want to incorporate my function adjustColumns in my TableModel, and I need help...
         void adjustColumns()
         // Ajuste les colonnes aux donnes pour que tout soit visible
         int nbRow,nbCol;
         nbRow = JTable1.getRowCount();
         nbCol = test.getColumnCount();
         for ( int i = 0; i < nbCol; i++ )
         com.sun.java.swing.table.TableColumn column = null;
         column = JTable1.getColumnModel().getColumn(i);
         int dataLength = 0;
         for ( int j = 0; j< nbRow; j++ )
         FontMetrics fm;
         int dataLengthTmp;
         String valueTable;
         fm = JTable1.getFontMetrics(JTable1.getFont());
         if ( test.getValueAt(j, i) == null )
         System.out.println("Valeur nulle...");
         dataLengthTmp = 0;
         else
         valueTable = test.getValueAt(j, i).toString();
         dataLengthTmp = fm.stringWidth(valueTable);
         System.out.println(valueTable + " = " + dataLengthTmp);
         if ( dataLengthTmp > dataLength )
         dataLength = dataLengthTmp;
         if ( dataLength != 0 )
    column.setWidth(dataLength + 5);
    else
    column.sizeWidthToFit();
    JTable1.setModel(test);
    JTable1.repaint();
    import java.util.Vector;
    import java.sql.*;
    import com.sun.java.swing.table.AbstractTableModel;
    import com.sun.java.swing.event.TableModelEvent;
    public class JDBCAdapter extends AbstractTableModel {
    Connection connection;
    Statement statement;
    ResultSet resultSet;
    String[] columnNames = {};
    Vector rows = new Vector();
    ResultSetMetaData metaData;
    public JDBCAdapter(String url, String driverName,
    String user, String passwd) {
    try {
    Class.forName(driverName);
    System.out.println("Ouverture de la connexion a la base de donnee...");
    connection = DriverManager.getConnection(url, user, passwd);
    statement = connection.createStatement();
    catch (ClassNotFoundException ex) {
    System.err.println("Cannot find the database driver classes.");
    System.err.println(ex);
    catch (SQLException ex) {
    System.err.println("Cannot connect to this database.");
    System.err.println(ex);
    public void executeQuery(String query) {
    if (connection == null || statement == null) {
    System.err.println("There is no database to execute the query.");
    return;
    try {
    resultSet = statement.executeQuery(query);
    metaData = resultSet.getMetaData();
    int numberOfColumns = metaData.getColumnCount();
    columnNames = new String[numberOfColumns];
    // Get the column names and cache them.
    // Then we can close the connection.
    for(int column = 0; column < numberOfColumns; column++) {
    columnNames[column] = metaData.getColumnLabel(column+1);
    // Get all rows.
    rows = new Vector();
    while (resultSet.next()) {
    Vector newRow = new Vector();
    for (int i = 1; i <= getColumnCount(); i++) {
    newRow.addElement(resultSet.getObject(i));
    rows.addElement(newRow);
    // close(); Need to copy the metaData, bug in jdbc:odbc driver.
    fireTableChanged(null); // Tell the listeners a new table has arrived.
    catch (SQLException ex) {
    System.err.println(ex+" query = "+query);
    public void executeUpdate(String query) {
    if (connection == null || statement == null) {
    System.err.println("There is no database to execute the query.");
    return;
    try {
    statement.executeUpdate(query);
    // close(); Need to copy the metaData, bug in jdbc:odbc driver.
    fireTableChanged(null); // Tell the listeners a new table has arrived.
    catch (SQLException ex) {
    System.err.println(ex+" query = "+query);
    public void close() throws SQLException {
    System.out.println("Fermeture de la connection a la base de donnee... Bye !");
    resultSet.close();
    statement.close();
    connection.close();
    protected void finalize() throws Throwable {
    close();
    super.finalize();
    // Implementation of the TableModel Interface
    // MetaData
    public String getColumnName(int column) {
    if (columnNames[column] != null) {
    return columnNames[column];
    } else {
    return "";
    public Class getColumnClass(int column) {
    int type;
    try {
    type = metaData.getColumnType(column+1);
    catch (SQLException e) {
    return super.getColumnClass(column);
    switch(type) {
    case Types.CHAR:
    case Types.VARCHAR:
    case Types.LONGVARCHAR:
    return String.class;
    case Types.BIT:
    return Boolean.class;
    case Types.TINYINT:
    case Types.SMALLINT:
    case Types.INTEGER:
    return Integer.class;
    case Types.BIGINT:
    return Long.class;
    case Types.FLOAT:
    case Types.DOUBLE:
    return Double.class;
    case Types.DATE:
    return java.sql.Date.class;
    default:
    return Object.class;
    public boolean isCellEditable(int row, int column) {
    try {
    return metaData.isWritable(column+1);
    catch (SQLException e) {
    return false;
    public int getColumnCount() {
    return columnNames.length;
    // Data methods
    public int getRowCount() {
    return rows.size();
    public Object getValueAt(int aRow, int aColumn) {
    Vector row = (Vector)rows.elementAt(aRow);
    return row.elementAt(aColumn);
    public String dbRepresentation(int column, Object value) {
    int type;
    if (value == null) {
    return "null";
    try {
    type = metaData.getColumnType(column+1);
    catch (SQLException e) {
    return value.toString();
    switch(type) {
    case Types.INTEGER:
    case Types.DOUBLE:
    case Types.FLOAT:
    return value.toString();
    case Types.BIT:
    return ((Boolean)value).booleanValue() ? "1" : "0";
    case Types.DATE:
    return value.toString(); // This will need some conversion.
    default:
    return "\""+value.toString()+"\"";
    public void setValueAt(Object value, int row, int column) {
    try {
    String tableName = metaData.getTableName(column+1);
    // Some of the drivers seem buggy, tableName should not be null.
    if (tableName == null) {
    System.out.println("Table name returned null.");
    String columnName = getColumnName(column);
    String query =
    "update "+tableName+
    " set "+columnName+" = "+dbRepresentation(column, value)+
    " where ";
    // We don't have a model of the schema so we don't know the
    // primary keys or which columns to lock on. To demonstrate
    // that editing is possible, we'll just lock on everything.
    for(int col = 0; col<getColumnCount(); col++) {
    String colName = getColumnName(col);
    if (colName.equals("")) {
    continue;
    if (col != 0) {
    query = query + " and ";
    query = query + colName +" = "+
    dbRepresentation(col, getValueAt(row, col));
    System.out.println(query);
    System.out.println("Not sending update to database");
    // statement.executeQuery(query);
    catch (SQLException e) {
    // e.printStackTrace();
    System.err.println("Update failed");
    Vector dataRow = (Vector)rows.elementAt(row);
    dataRow.setElementAt(value, column);
    Thanks to help me.

    Hi,
    OK. I have read your code sample again. It looks like the JDBCAdapter class is reloading table data in the executeQuery method. Why not call adjustColumns at the end of this method after the new rows and columns are loaded? Perhaps it also should be called at the end of executeUpdate. Have you tried doing that?
    I would still set
    JTable1.setAutoCreateColumnsFromModel (false); to prevent Java from readjusting the size automatically at some other time.
    regards,
    Terry

  • Maximum Allowed Text Length for JTable Column

    Can you please help me with a JTable Doubt
    How do I set the Maximum Allowed Text Length for a Particular Column of a JTable?

    Thanks a lot mate. I used the following
         class MaximumLengthFilter extends DocumentFilter {
                   public void replace(DocumentFilter.FilterBypass fb, int offset, int length,
                             String text, AttributeSet attr) throws BadLocationException {
                        if ((fb.getDocument().getLength() + length) < 10)
                             fb.replace(offset, length, text, attr);
                        else
                             Toolkit.getDefaultToolkit().beep();
              }

  • Diff between valid for consolidation and aggregation property in ODI column

    Hi John,
    I have a query regarding the columns when we revers the dimensions in ODI. In the columns tab of each dimension, there is valid for consolidation column. What does this column to when we select it. Coz any how i will be using the aggregation for plan type where i will be giving the consolidation operator. Could you please let me know the differences between them
    And also there is one more column Operation. What does this do

    Hi,
    You can ignore the "valid for consolidation column" as far as I am aware it is not used.
    Operation is for different types of load, these are
    Update (default)–Adds, updates, or moves the member being loaded.
    Delete Level 0–Deletes the member being loaded if it has no children.
    Delete Idescendants–Deletes the member being loaded and all of its descendants.
    Delete Descendants–Deletes the descendants of the member being loaded, but does
    not delete the member itself.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How to disable/enable the cells for editing column wise in JTable in java?

    Hi All,
    Can any one tell me how to disable the cells for editing by column wise in JTable?
    Here depending upon the radio button selected, I need 2 disable some columns for editing
    and enable some columns for editing?
    how can I do tat using JAVA?
    Any sample code is of great help to me.
    Thanks in Advance

    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
    ~

  • JTable - One Column Heading for Two Columns

    Can you adjust the default JTable to have one column heading for two columns of data? Is there a simple span command? I've looked at the api for JTable and JTableHeader and didn't see anything, is there something I'm missing? Any help would be appreciated.

    What i am trying to accomplish is have column 'E' span 2 columns.
    This is my code thus far, however it give the error from my pryor message. I am pretty sure it is because I'm using and Object[][] and a String[] instead of Vectors. What corrections do I need to make in order for my goal of:
    [ A ][ B ][ C ][ D ][ E  ][ F ][ G ]
    [ 1 ][ 2 ][ 3 ][ 4 ][5][6][ 7 ][ 8 ]
    Object[][] data = new Object[ROWS][COLUMNS];
    String[] columnNames = {"A","B","C","D","E","E","F","G"};
    table = new JTable(data, columnNames);
    table.setBackground(Color.white);
    table.addKeyListener(this);
    DefaultTableCellRenderer d = new DefaultTableCellRenderer();
    d.setHorizontalAlignment(JLabel.CENTER);
    table.setDefaultRenderer(table.getColumnClass(0),d);
    for (int i = 0; i < table.getColumnCount(); i++){
    TableColumn aColumn = header.getColumnModel().getColumn(i);
    TableCellRenderer renderer = aColumn.getHeaderRenderer();
    if (renderer == null) {
    renderer = new DefaultTableCellRenderer(){
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column){
    JTableHeader header = table.getTableHeader();
    if (header != null) {
    setForeground(header.getForeground());
    setBackground(header.getBackground());
    setFont(header.getFont());
    setHorizontalAlignment(JLabel.CENTER);
    setText((value == null) ? "" : value.toString());
    setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    return this;
    aColumn.setHeaderRenderer(renderer);

  • List Column Validation Formula for Text

    I want to use the List Column Validation to prevent users from entering a period "." into a text field. If they try to save the list with a period in the text field the message would be displayed. What formula syntax will allow me to do this?

    Bob,
    You are correct, the validation formula needs to evaluate to true (valid) or false (invalid).  We could simplify the above even further by using =ISERROR(FIND(".",Title)).  The reason we can remove the "IF" portion of the formula is because
    ISERROR is already returning true when the FIND function fails to locate a period in the Title.
    The IF statement comes in handy at times and it takes 3 parameters.  The first is an expression to evaluate, the next is a value to return when the expression is true, and the last is a value to return when the expression is false.  Let's
    say you wanted the opposite and enforce all Titles to include a period.  You could change the above formula by simply reversing the position of the true/false values of the IF statement as follows:
    =IF(ISERROR(FIND(".", [Title])),FALSE,TRUE)

  • Column width in JTables.Help needed!!!!

    Hi
    I am trying to print out a JTable and have had a few problems along the way but have managed to solve them all so far apart from this one. When the JTable is shown on screen it doesn't make the columns wide enough . I ahev managed to find some code from these forums but it doesnt resize correctly if the Column headings contain more text than any of the data (If you know what i mean). Below is the code i am using
    public void sizeAllColumnsToFitData (JTable table)  {
        for (int col = 0; col < table.getColumnCount (); col++)  {
          TableColumn curColumn = table.getColumn (table.getColumnName (col));
          if (curColumn == null)
            continue; // not a valid column skip
    //  Translate to the model
          int modelColumn = curColumn.getModelIndex ();
    //  Loop for all rows in this column looking for the widest piece of data
          int maxColumnWidth = 0;
          for (int row = 0; row < table.getRowCount(); row++)  {
            TableCellRenderer curCellRenderer = table.getCellRenderer (row, modelColumn);
            Object value = table.getValueAt (row, modelColumn);
            Component curRenderComponent = curCellRenderer.getTableCellRendererComponent(table, value, true, true, row, modelColumn);
            Dimension cellDimension = curRenderComponent.getPreferredSize ();
            if (cellDimension.width > maxColumnWidth)
              maxColumnWidth = cellDimension.width;
    //  Set the column width to fit the maximum
          Dimension cellSpacing = table.getIntercellSpacing ();
          curColumn.setPreferredWidth (maxColumnWidth + (cellSpacing != null ? cellSpacing.width : 1));
      }I pass my table into here and it works fine apart from in doesnt take into consideration the size of the headings. Please Help ME!!!!

    java.lang.NullPointerException
         at database_testing.SLAMS.sizeAllColumnsToFitData(SLAMS.java:473)
         at database_testing.SLAMS.getInfo(SLAMS.java:364)
         at database_testing.SLAMS.getInfo_actionPerformed(SLAMS.java:434)
         at database_testing.SLAMS_getInfo_actionAdapter.actionPerformed(SLAMS.java:527)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
         at java.awt.Component.processMouseEvent(Component.java:5134)
         at java.awt.Component.processEvent(Component.java:4931)
         at java.awt.Container.processEvent(Container.java:1566)
         at java.awt.Component.dispatchEventImpl(Component.java:3639)
         at java.awt.Container.dispatchEventImpl(Container.java:1623)
         at java.awt.Component.dispatchEvent(Component.java:3480)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
         at java.awt.Container.dispatchEventImpl(Container.java:1609)
         at java.awt.Window.dispatchEventImpl(Window.java:1590)
         at java.awt.Component.dispatchEvent(Component.java:3480)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)Also i think it may have something to do with my headerRenderer being null cus if i replace the line TableCellRenderer headerRenderer = curColumn.getHeaderRenderer(); with TableCellRenderer headerRenderer = table.getTableHeader().getDefaultRenderer(); then it doesnt come up with an error but only increase the size of the coluns (where neccessary by 2 characters)

  • How to get all the values in one column of a JTable

    How to get all the values in one column of a JTable as a Collection of String.
    I don;t want to write a for loop to say getValueAt(row, 1) eg for 2nd column.

    I don;t want to write a for loop to say getValueAt(row, 1) eg for 2nd column. You could always write a custom TableModel that stores the data in the format you want it. It would probably be about 50 lines of code. Or you could write a loop in 3 lines of code. I'll let you decide which approach you want to take.

Maybe you are looking for

  • No earbuds work for the left side...why dis it not working?

    My sons and husbands iphones work just fine with earbuds that dont work on mine. Why is mine not working? Earbuds used to work but not anymore.

  • How do I fix the red screen on Premiere Pro CC 2014?

    Past few weeks, Premiere Pro has not been playing some of my video files properly. Here are the computer specs. Mac Pro (late 2013) 3.5 GHz 6-core Intel Xeon E5 32 GB 1866 MHz DDR3 ECC AMD FirePro D700 6144 MB Recorded on: Canon XF 300 1920x1080 29.9

  • What are the different ways of retrieving data from Oracle8i

    What are the different ways of retrieving data from Oracle8i into my HTML page ? Is it JDBC and ODBC ? Is there any other way ? null

  • Finding Sum of grouped lines / Tables EKKO, EKPO

    Hi, am using the following tables: TABLES: ekko,ekpo. with Inner Join select ekkobukrs ekkoebeln ekkoaedat ekkobsart ekkoekgrp ekkolifnr ekkowaers ekkowkurs ekkoernam ekpobrtwr    into CORRESPONDING FIELDS OF TABLE itab from ekko     inner join EKPO

  • Add song to playlist while home sharing?

    Hi All, Taking advantage of Home Sharing and everything works fine except for one thing: while listening to the shared library should the desire arise to add the current song to a playlist there's no way to do it, or is there? Currently I have to scr