How checkbox can be creted in table.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Man4ish
    New Member
    • Mar 2008
    • 151

    #1

    How checkbox can be creted in table.

    I am trying to create a table with three columns.
    first two columns will be having text values while last column has checkbox. How it can implemented? Any example doing the same will really help me.


    Thanks in advance.
  • chaarmann
    Recognized Expert Contributor
    • Nov 2007
    • 785

    #2
    Use a two-dimensional array of class Object.

    Tip: instead of accessing the elements directly, wrap around a class with setter and getter methods.

    Comment

    • Man4ish
      New Member
      • Mar 2008
      • 151

      #3
      I am beginner in this field. I am C++ programmer moving into java. Working on table with check box as last column. How can i do it?

      Comment

      • intriken
        New Member
        • Feb 2007
        • 6

        #4
        Code:
        TableColumn checkboxcol = Jtable.getColumnModel().getColumn(x)
        checkboxcol..setCellEditor(new CheckboxTableCellEditor());
        checkboxcol.setCellRenderer(new CheckboxTableCellRenderer ());
        
        public class CheckboxTableCellRenderer extends JCheckBox implements TableCellRenderer {
        }
        
        public class CheckboxTableCellEditor extends DefaultCellEditor {
        public CheckboxTableCellEditor () {
           super(new JCheckBox());
        }

        something like that is what you want to do but with everythign implemented and correctly

        Comment

        Working...