JTable: Highlighting multiple rows

Hello,
I have a simple problem: I want to highlight rows 2,4 and 8 of a JTable using the colors blue, red and green respectively. (JTable is being used as a spreadsheet)
How do I do this? Can someone please help.
Thanks,
Nadeem

Search the forum for jtable row +highlight and you should find your answer somewhere on the list:
http://onesearch.sun.com/search/developers/index.jsp?col=devforums&qp_name=Swing&qp=forum%3A57&qt=%2Bjtable+%2Brow+%2Bhighlight
;o)
V.V.

Similar Messages

  • Highlight multiple rows with coding

    Hi all,
    Can anybody solved my problem?
    I have 3 JTable which are dependent of each other.
    Hence if i select a row in one of them, the other 2 need to highlighted
    respectively.
    I understand that using
    JTable.setRowSelectionInterval(int index0, int index1)
    can highlight rows by code, but it needs to be in a running order.
    I need to accomodate selection of multiple rows, some not in a running order.
    Anyway, thanks for your help in advance...

    Hi,
    Try compiling what I wrote below and running it. I'm pretty sure this is what you are trying to do?! Let me know if this is what you want.
    Thanks,
    code below
    package mypackage;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.event.*;
    import java.util.EventObject;
    public class Dialog1 extends JDialog {
    JPanel _mainPanel;
    JTable _table1;
    JTable _table2;
    JTable _table3;
    MyListSelectionListener _table1Lstnr;
    MyListSelectionListener _table2Lstnr;
    MyListSelectionListener _table3Lstnr;
    Object[] _tablecol = {"Column1", "Column2", "Column3"};
    Object[][] _tablerow = { {"row1", "row1", "row1"},
    {"row2", "row2", "row2"},
    {"row3", "row3", "row3"},
    {"row4", "row4", "row4"},
    {"row5", "row5", "row5"},
    {"row6", "row6", "row6"}};
    Dimension TABLE_DIM = new Dimension( 50, 100 );
    public Dialog1() {
    this.setTitle("Test Frame");
    this.setModal(true);
    init();
    public void init() {
    _mainPanel = new JPanel( new GridBagLayout() );
    GridBagConstraints gbConstraints = new GridBagConstraints( 0,0,1,1,1,0,
    GridBagConstraints.NORTHWEST,GridBagConstraints.HORIZONTAL,
    new Insets(5,5,5,5),0,0);
    table1 = new JTable(tablerow, _tablecol);
    _table1.setName("table1");
    _table1.setColumnSelectionAllowed(false);
    _table1.setRowSelectionAllowed(true);
    table1.setSelectionMode(ListSelectionModel.MULTIPLEINTERVAL_SELECTION);
    table1Lstnr = new MyListSelectionListener(table1);
    table1.getSelectionModel().addListSelectionListener( table1Lstnr );
    JScrollPane table1SP = new JScrollPane( _table1 );
    table1SP.setPreferredSize( TABLE_DIM );
    _mainPanel.add( table1SP, gbConstraints );
    gbConstraints.gridy = 1;
    table2 = new JTable(tablerow, _tablecol);
    _table2.setName("table2");
    _table2.setColumnSelectionAllowed(false);
    _table2.setRowSelectionAllowed(true);
    table2.setSelectionMode(ListSelectionModel.MULTIPLEINTERVAL_SELECTION);
    table2Lstnr = new MyListSelectionListener(table1);
    table2.getSelectionModel().addListSelectionListener( table2Lstnr );
    JScrollPane table2SP = new JScrollPane( _table2 );
    table2SP.setPreferredSize( TABLE_DIM );
    _mainPanel.add( table2SP, gbConstraints );
    gbConstraints.gridy = 2;
    gbConstraints.weighty = 1;
    table3 = new JTable(tablerow, _tablecol);
    _table3.setName("table3");
    _table3.setColumnSelectionAllowed(false);
    _table3.setRowSelectionAllowed(true);
    table3.setSelectionMode(ListSelectionModel.MULTIPLEINTERVAL_SELECTION);
    table3Lstnr = new MyListSelectionListener(table1);
    table3.getSelectionModel().addListSelectionListener( table3Lstnr );
    JScrollPane table3SP = new JScrollPane( _table3 );
    table3SP.setPreferredSize( TABLE_DIM );
    _mainPanel.add( table3SP, gbConstraints );
    this.getContentPane().add( _mainPanel );
    class MyListSelectionListener implements ListSelectionListener {
    JTable selectedTable;
    MyListSelectionListener(JTable table) {
    selectedTable = table;
    public void valueChanged(ListSelectionEvent e) {
    String tableName = selectedTable.getName();
    int[] selectedRows;
    if( tableName.equals(_table1.getName()) ) {
    selectedRows = _table1.getSelectedRows();
    table2.getSelectionModel().removeListSelectionListener( table2Lstnr );
    table3.getSelectionModel().removeListSelectionListener( table3Lstnr );
    _table2.clearSelection();
    _table3.clearSelection();
    for( int i=0;i<selectedRows.length;i++){
    _table2.addRowSelectionInterval(selectedRows,selectedRows[i]);
    _table3.addRowSelectionInterval(selectedRows[i],selectedRows[i]);
    table2Lstnr = new MyListSelectionListener(table2);
    table3Lstnr = new MyListSelectionListener(table3);
    table2.getSelectionModel().addListSelectionListener( table2Lstnr );
    table3.getSelectionModel().addListSelectionListener( table3Lstnr );
    } else if( tableName.equals( _table2.getName()) ) {
    selectedRows = _table2.getSelectedRows();
    table1.getSelectionModel().removeListSelectionListener( table1Lstnr );
    table3.getSelectionModel().removeListSelectionListener( table3Lstnr );
    _table1.clearSelection();
    _table3.clearSelection();
    for( int i=0;i<selectedRows.length;i++){
    _table1.addRowSelectionInterval(selectedRows[i],selectedRows[i]);
    _table3.addRowSelectionInterval(selectedRows[i],selectedRows[i]);
    table1Lstnr = new MyListSelectionListener(table1);
    table3Lstnr = new MyListSelectionListener(table3);
    table1.getSelectionModel().addListSelectionListener( table1Lstnr );
    table3.getSelectionModel().addListSelectionListener( table3Lstnr );
    } else if( tableName.equals( _table3.getName()) ) {
    selectedRows = _table3.getSelectedRows();
    table1.getSelectionModel().removeListSelectionListener( table1Lstnr );
    table2.getSelectionModel().removeListSelectionListener( table2Lstnr );
    _table1.clearSelection();
    _table2.clearSelection();
    for( int i=0;i<selectedRows.length;i++){
    _table1.addRowSelectionInterval(selectedRows[i],selectedRows[i]);
    _table2.addRowSelectionInterval(selectedRows[i],selectedRows[i]);
    table1Lstnr = new MyListSelectionListener(table1);
    table2Lstnr = new MyListSelectionListener(table2);
    table1.getSelectionModel().addListSelectionListener( table1Lstnr );
    table2.getSelectionModel().addListSelectionListener( table2Lstnr );
    public static void main(String[] args) {
    Dialog1 dialog = new Dialog1();
    dialog.setSize( new Dimension( 400, 400 ) );
    dialog.setVisible(true);

  • Can we create JTable with multiple rows with varying number of columns ?

    Hi All,
    I came across a very typical problem related to JTable. My requirement is that cells should be added dynamically to the JTable. I create a JTable with initial size of 1,7 (row, columns) size. Once the 7 columns are filled with data, a new row should be created. But the requirement is, the new row i.e. second row should have only one cell in it initially. The number of cells should increase dynamically as the data is entered. The table is automatically taking the size of its previous row when new row is added. I tried by using setColumnCount() to change the number of columns to '1' for the second row but the same is getting applied to the first row also.
    So can you please help me out in this regard ? Is it possible to create a JTable of uneven size i.e. multiple rows with varying number of columns in each row ?
    Thanks in Advance.

    Well a JTable is always going to paint the same number of columns for each row. Anything is possible if you want to rewrite the JTable UI to do this, but I wouldn't recommend it. (I certainly don't know how to do it).
    A simpler solution might be to override the isCellEditable(...) method of JTable and prevent editing of column 2 until data in column 1 has been entered etc., etc. You may also want to provide a custom renderer that renderers the empty column differently, maybe with a grey color instead of a white color.

  • JTable with Multiple Row Header

    well, Im do an application thats need formated ISOS Sheets, and most of them have a Table with Multiple Row Header , and Groupable Header, and both of them. I have the .java and in the class MultipleRowHeaderExample calls a class AttributiveCellTableModel for setColumnIdentifiers() and setDataVector() the cue is why this print stack :
    Exception in thread "main" java.lang.StackOverflowError
         at java.util.Vector.<init>(Unknown Source)
         at java.util.Vector.<init>(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:54)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
    .if in main class, have initialized the data, and column vars
    public class MultipleRowHeaderExample extends JFrame {
      Object[][] data;
      Object[] column;
      JTable table;
      MultiSpanCellTable fixedTable;
      public MultipleRowHeaderExample() {
        super( "Multiple Row Header Example" );
        setSize( 400, 150 );
        data =  new Object[][]{
            {"SNo."    ,"" },
            {"Name"    ,"1"},
            {""        ,"2"},
            {"Language","1"},
            {""        ,"2"},
            {""        ,"3"}};
        column = new Object[]{"",""};
        AttributiveCellTableModel fixedModel = new AttributiveCellTableModel(data, column) {
          public boolean CellEditable(int row, int col) {
            return false;
        };

    What's the code in AttributiveCellTableModel?
    * (swing1.1beta3)
    package jp.gr.java_conf.tame.swing.table;
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.event.*;
    * @version 1.0 11/22/98
    public class AttributiveCellTableModel extends DefaultTableModel {
      protected CellAttribute cellAtt;
      public AttributiveCellTableModel() {
        this((Vector)null, 0);
      public AttributiveCellTableModel(int numRows, int numColumns) {
        Vector names = new Vector(numColumns);
        names.setSize(numColumns);
        setColumnIdentifiers(names);
        dataVector = new Vector();
        setNumRows(numRows);
        cellAtt = new DefaultCellAttribute(numRows,numColumns);
      public AttributiveCellTableModel(Vector columnNames, int numRows) {
        setColumnIdentifiers(columnNames);
        dataVector = new Vector();
        setNumRows(numRows);
        cellAtt = new DefaultCellAttribute(numRows,columnNames.size());
      public AttributiveCellTableModel(Object[] columnNames, int numRows) {
        this(convertToVector(columnNames), numRows);
      public AttributiveCellTableModel(Vector data, Vector columnNames) {
        setDataVector(data, columnNames);
      public AttributiveCellTableModel(Object[][] data, Object[] columnNames) {
        setDataVector(data, columnNames);
      public void setDataVector(Vector newData, Vector columnNames) {
        if (newData == null)
          throw new IllegalArgumentException("setDataVector() - Null parameter");
        dataVector = new Vector();
        setColumnIdentifiers(columnNames);
        dataVector = newData;
        cellAtt = new DefaultCellAttribute(dataVector.size(),
                                           columnIdentifiers.size());
        newRowsAdded(new TableModelEvent(this, 0, getRowCount()-1,
               TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
      @Override
      public void setColumnIdentifiers(Vector arg0) {
              // TODO Auto-generated method stub
              super.setColumnIdentifiers(arg0);
      public void addColumn(Object columnName, Vector columnData) {
        if (columnName == null)
          throw new IllegalArgumentException("addColumn() - null parameter");
        columnIdentifiers.addElement(columnName);
        int index = 0;
        Enumeration enumeration = dataVector.elements();
        while (enumeration.hasMoreElements()) {
          Object value;
          if ((columnData != null) && (index < columnData.size()))
           value = columnData.elementAt(index);
          else
         value = null;
          ((Vector)enumeration.nextElement()).addElement(value);
          index++;
        cellAtt.addColumn();
        fireTableStructureChanged();
      public void addRow(Vector rowData) {
        Vector newData = null;
        if (rowData == null) {
          newData = new Vector(getColumnCount());
        else {
          rowData.setSize(getColumnCount());
        dataVector.addElement(newData);
        cellAtt.addRow();
        newRowsAdded(new TableModelEvent(this, getRowCount()-1, getRowCount()-1,
           TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
      public void insertRow(int row, Vector rowData) {
        if (rowData == null) {
          rowData = new Vector(getColumnCount());
        else {
          rowData.setSize(getColumnCount());
        dataVector.insertElementAt(rowData, row);
        cellAtt.insertRow(row);
        newRowsAdded(new TableModelEvent(this, row, row,
           TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
      public CellAttribute getCellAttribute() {
        return cellAtt;
      public void setCellAttribute(CellAttribute newCellAtt) {
        int numColumns = getColumnCount();
        int numRows    = getRowCount();
        if ((newCellAtt.getSize().width  != numColumns) ||
            (newCellAtt.getSize().height != numRows)) {
          newCellAtt.setSize(new Dimension(numRows, numColumns));
        cellAtt = newCellAtt;
        fireTableDataChanged();
      public void changeCellAttribute(int row, int column, Object command) {
        cellAtt.changeAttribute(row, column, command);
      public void changeCellAttribute(int[] rows, int[] columns, Object command) {
        cellAtt.changeAttribute(rows, columns, command);
    }that's it

  • Highlight Multiple Rows in a Report

    Hello all,
    I'm trying to implement a highlight as seen here,
    http://www.netlobo.com/javascript_background_color_toggle.html
    function toggleBgColor(elem)
    var style2 = elem.style;
    style2.backgroundColor = style2.backgroundColor? "":"#FFFF00";
    I have the above javascript in my report's region header and an onclick = "toggleBgColor(this);" in my report template (Horizontal border)
    I can run the page, but nothing happens on click. No errors and no highlighting.
    Any ideas are much appreciated.
    Thanks

    Both places should work, but the page header is cleaner.
    Maybe it's not in the correct place in the template? Can you put up an example on apex.oracle.com?
    I linked to Carl's sample app more as a general HTML/CSS/javascript intro, especially for plugging things into APEX. He doesn't have an example exactly like you're looking for, but he does have some row highlighting here.

  • Highlighting corresponding rows in table with mouseover

    I have a requirement where I need to highlight multiple rows that are logically grouped together in a table. I was thinking of accomplishing this by:
    1. Add an invisible column to the table.
    2. Set the column's StyleClass in the code to some indicator.
    3. Add a client listener to the table/row?? of type mouseover to identify the row being hovered over.
    4. In Javascript, select all the rows that have the same StyleClass as the row being hovered over and set their background color.
    I am having trouble with step #3 because I am unable to add the client listener to a table/row to identify the row that is hovered over. Note that the user is not clicking on the row so I cannot use the "current row".
    If there is no way to identify the row, is there any other way to highlight multiple rows on mouseover?
    I am using JDeveloper 11.1.1.5.
    Thanks.

    Hi Frank, I tried adding the clientListener to each cell renderer component but the problem I noticed with that was that the cell components do not always occupy the entire width of the column so the user has to hover over the cell which may be a tiny part of the cell.
    I did however find an alternate solution using JQuery. So instead of adding the client listeners to each component, I added a JQuery .hover() function on document load. Below is the javascript that is loaded on the page load.
    <af:resource type="javascript">
    function initialize()
    //the class name that will be looked at in the DOM and highlighted
    var classToHighlight = "";
    //TODO will need to use .live("hover") if using PPR on the page
    $('.columnClass').hover(
    function(data)
    $($(this).attr('class').split(' ')).each(function()
    if (this !== '')
    if ( this.indexOf("bgHighlightClass") == 0 )
    classToHighlight = this;
    $("." + classToHighlight).css('background-color', 'orange');
    function(data)
    $("." + classToHighlight).css('background-color', 'white');
    classToHighlight = "";
    </af:resource>
    <af:clientListener method="initialize" type="load"/>

  • How to highlight the row from the JTable then remove

    hi !!
    i'm using an abstract model in making a table....
    and having a button up and down and delete also!!
    how can i highlight the row when i click down and up!!!
    and when selected or highlighted i can press the button delete ...
    then the data is removed!!!
    pls... i need it!!
    tnx...

    Table row selection should take care of it. By default table rows can be selected.
    The getSelectionModel() method on the JTable gives you access to the row selection model. You can set that either to allow one at a time or multiple selection, and when your delete button is pressed, you access that selection model to decide which rows to delete.
    Add a ListSelectionListener so you can enable or disable your delete button as rows are selected or deselected. JTable will take care of the highlighting.

  • Highlighting different rows within a JTable

    I have a JTable that has 20 rows. I also have a Jlist next to the JTable. When someone selects something within the Jlist I want to highlight certain rows depending on what was selected within that list. For instance if a user selects Item1 within the list I want to highlight the 3rd, 8th and 11th row within a JTable. The problem is the JTable API will let you highlight a number of rows but not allow you to specify single rows to highlight at one time. When I run my code to do this I get the last row highlighted. The reason is because the 3rd and 8th row do get highlighted but when I call the setRowSelectionInterval(i, i); where i is the row to highlight it has already passed and will end up highlighting the 11th row only. Is there any work around for this?

    First, make sure you table supports multi-select. Turn it on in this case, otherwise you can't select multiple items.
    To color different rows, you'll have to set a cell renderer and use it to color those rows. It's possible to collor each and every cell a different color, set fonts, images, etc..you just need a good cell renderer.

  • Disabling multiple row selection in JTable

    hi,
    I have a JTable and I want to disable the multiple row selection.
    I used
    getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);and this working fine with ctr+clicking on a row
    but if i am using shift key instead of Ctrl key multiple selection is possible....
    Any idea y?and how to resolve it??
    thnx
    ~neel

    Use table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);I don't know if it differs but I use it and I don't have the problems you describe. Might be a bug in your Java version?!
    Message was edited by:
    pholthuizen

  • Select multiple rows on a JTable

    Hi!
    Given: JTable, multiple selection allowed
    Wanted: a way to be able to set multiple non-continuous rows selected
    eg. on a JTable with 5 rows,
    I want to set rows 1, 3 and 5 selected
    Anyone?
    Stoffel.

    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTE
    VAL_SELECTION);
    select rows using <ctrl> and/or <shift>Or if you want to set programaticly use this methods, see the api
    for explanation.
    table.changeSelecton(int row, int column, boolean toogle, boolean extend);
    table.addRowSelection(int index0, int index1);
    table.addColumnSelectionInterval(int index0, int index1)
    ...

  • Delete multiple rows in a JTable ADF Swing.

    hi guys,
    Would anyone know tell me how do I delete multiple rows in a JTable ADF Swing?
    JDeveloper.

    Hi,
    I would configure the table for multi row selection. Then get the selected row index, access the iterator in the PageDef file (through the panelBinding reference you have in ADF Swing) and then iterate over the selected row indexes, make an index to become the current row and call remove() on it
    Frank

  • Free alternatives to JTable that allow multiple rows in the header?

    My goal is to make a table with two or more rows in the column header. For instance, imagine I want to have the numbers of the days in the calendar as columns, then I want to have a row over them with the months, spanning over multiple days, then I want to have a row over that with the year, spanning over multiple months. I want these rows to be in the column header so they're always visible as you scroll down.
    Right now, I'm doing this with the first rows of the grid, out of the header, so they get out of view when the user scrolls down. Also, by being in the actual grid, they screw up sorting of the table.
    So I need 2 features. Multiple rows in the column header and the ability to merge multiple cells in the header.
    I've see some code to do this but it seemed too complicated so I want to see if I can find a component that does this out of the box first. I've seen 2 3rd party JTable-based components that do this but they're paid products and paying the full price of a component bundle for these features isn't a very attractive idea.
    So, does anyone know of a good table component that does this?

    Have a look at JXTable from the SwingX project. You should be able to find it via Google.

  • Select single column but multiple rows in JTable

    Hi
    I have a jTable and want to be able to select multiple rows but only in a single column.
    I've set these properties which makes selection almost the way I would like it.
    table1.setCellSelectionEnabled(true);
    table1.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);the only problem now is that the user can select multiple columns.
    Is there a simple way to restrict selection to single column?
    regards
    abq

    table.setCellSelectionEnabled(true);
    table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    DefaultListSelectionModel model =
         (DefaultListSelectionModel)table.getColumnModel().getSelectionModel();
    model.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

  • Cell value spanning multiple rows in JTable

    Hi,
    I have a JTable where I want a single column value alone to span multiple rows.
    Something like
    Course No. | Location | Cost
    | loc1 | 1000
    1 ---------------------------------------------
    | loc2 | 2000
    How can I create a JTable like this?
    Thanks for the help.

    I have a link for that,
    http://www2.gol.com/users/tame/
    go in swing examples, JTable #4.
    Hope it helps :)

  • Delete Multiple Rows of JTable by selecting JCheckboxes

    Hi,
    I want delete rows of JTable that i select through JCheckbox on clicking on JButton. The code that i am using is deleting one row at a time. I want to delete multiple rows at a time on clicking on Button.
    This is the code i m using
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class TableTest extends JFrame implements ActionListener
         JButton btnAdd;
         BorderLayout layout;
         DefaultTableModel model;
         JTable table;JButton btexcluir;
         public static void main(String[] args)
              TableTest app = new TableTest();
              app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public TableTest()
              super("Table Example");
              btnAdd = new JButton("Add");
              btnAdd.addActionListener(this);
              model = new DefaultTableModel()
                   public Class getColumnClass(int col)
                        switch (col)
                             case 1 :
                                  return Boolean.class;
                             default :
                                  return Object.class;
              table = new JTable(model);
              table.setPreferredSize(new Dimension(250,200));
              // Create a couple of columns
              model.addColumn("Col1");
              model.addColumn("Col2");
              JCheckBox cbox = new JCheckBox();
              // Append a row
              JPanel painel = new JPanel();
              model.addRow(new Object[] { "v1",new Boolean(false)});
              model.addRow(new Object[] { "v3", new Boolean(false)});
              JScrollPane scrollPane = new JScrollPane(table);
              scrollPane.createVerticalScrollBar();
              btexcluir= new JButton("Excluir");
              btexcluir.addActionListener(this);
              painel.add(btexcluir);
              painel.add(btnAdd);
              getContentPane().add(scrollPane, BorderLayout.NORTH);
              getContentPane().add(painel, BorderLayout.SOUTH);
              setSize(600, 600);
              setVisible(true);
         public void actionPerformed(ActionEvent e)     {
           if (e.getSource() == btnAdd)     
              model.addRow(new Object[] { "Karl", new Boolean(false)});
           if (e.getSource()==btexcluir){
                for (int i=0; i <=model.getRowCount(); i++){
                     if (model.getValueAt(i,1)==Boolean.FALSE)
                          JOptionPane.showMessageDialog(null, "No lines to remove!!");
                     else if(model.getValueAt(i,1)==Boolean.TRUE)
                          model.removeRow(i);
    }Please reply me with code help.
    Thanks
    Nitin

    Hi,
    Thanks for ur support. My that problem is solved now. One more problem now . Initially i want that delete button disabled. When i select any checkbox that button should get enabled. how can i do that ?
    Thanks
    Nitin

Maybe you are looking for

  • Java Add-In installation for Abap

    Hello Friends, I have installed NW2004s Abap stack for use BW features. Now, I need to install Java Add-In (including EP and BI Java to use BEX and Integrated Planning) in this same installation. In SAPINST (Additional Software Lifecycle -> Java Add-

  • 8mm cassettes out the wazoo!!

    I have about 26 8mm cassettes ranging from the years of 1993-2002, I am trying to figure out the best way to get them digitized and saved, I also have 2 mini dv tapes which went pretty good importing into imovie and saved well, so I am happy with tho

  • Mounting Sensor on Shoe: One concern:

    Hello, I did mount the sensor on the lace of my NB-Shoe with velcro. It worked quite nice. My concern: Now the wether is nice: sunny and dry. But in autumn and winter it get's quite cold/rainy/snow/muddy around here (Berlin, Germany). Is the strong e

  • Indexes in 'Pending' status...

    Hi all, we are facing problem with our TREX 7.0. I created two indexes with relevant data assigned to them and clicked on 'Reindex' (with standard crawler set) but both of them are stuck in 'Pending' status with no files processed even several hours

  • Unable to open RTSP links

    Hi, I am trying to access rtsp links through my mobile but it is not working. It looks like RTSP port is blocked. Please let me know how to configure verizon router to enable rtsp port. Thanks