How to Make a Checkbox editable in a JTable?

I have a CustomModel inheriting from the AbstractTable Model. I make the isCellEditable( ) function in the CustomModel return true for all the columns(pl. see code snippet). One of the columns returns a Boolean value (checkbox in the table) and the rest of the columns return Strings (JLabels in the table). I can edit the all the columns which return text (JLabels), but cant seem to edit the column containing the Boolean Value (checkbox). How can I make the checkbox editable?
Help is greatly appreciated...
here is a piece of the sample code:
public class CustomModel extends AbstractTableModel
private Vector _columnMaps = null;
private MyDefaultData _data = null;
public SniTableModel(Vector columnMaps, MyDefaultData data)
_columnMaps = columnMaps;
_data = data;
public Class getColumnClass(int col)
Object value = getValueAt(0, col);
if (value != null)
return value.getClass();
else
return (new Object()).getClass();
public boolean isCellEditable(int row, int col)
return true;
}

Try this:
i) extend DefaultTableModel instead of AbstractTableModel
ii) public Class getColumnClass(int c) {
if (this.getValueAt(0,c) == null)
return super.getColumnClass(c);
else
//convert booleans to checkboxes in the table
return super.getValueAt(0, c).getClass();

Similar Messages

  • How to make an checkbox editable and uneditable within a single alv output.

    Hi,
    How to make an checkbox editable and uneditable within a single alv output depending on condition.
    I have used Reuse_alv_grid_display.
    In my output every checkbox is editable. i have used edit = 'X'.
    I want editable checkbox for correct value and uneditable checkbox for incorrect value in a single alv

    >
    Mukilansap wrote:
    > I want editable checkbox for correct value and uneditable checkbox for incorrect value in a single alv
    Use alv styles to achieve this, set the style for each record before displaying the ALV. Structure LVC_S_STYL.
    Take a look at the example BCALV_EDIT_02, it is OOPS based, but check how the style table is filled.
    regards,
    Advait

  • How to make table as "editable false"

    Dear Forum,
    i am user of jDeveloper jClient/Swing .jpr.
    cutomer table having following attributes-
    1.cust_id (primary key)
    2.cust_name
    3.cust_add
    Suppose customerview bind with jTable1.
    Using ViewObjectEditor, i set "updateable never" for all fields.
    This show error, when data insert into table " cust_id as
    read only".
    Help me, Using jClient Binding how to make Table as "editable false".

    Overriding method prepareEditor() for new table:
    private JTable tableList = new JTable(){
    public Component prepareEditor(TableCellEditor editor, int row, int column) {
    // 1 and 2 column is not editable
    if(column == 0 || column == 1){ return null; }
    return super.prepareEditor(editor, row, column);

  • How to make a checkbox mandatory

    Hello,
    I created  a checkbox where I want the user to check that they have read and acknowledged a privacy statement.
    I am curious how I make the checkbox mandatory, as I dont see an option in the Object Pallete.
    Thanks in advance!
    Nik

    Write the following line code on initialize event of the CheckBox to make it mandatory.
    this.mandatory = 'error'
    Nith

  • How to make a CheckBox for a report parameter?

    Hi,
    How to make a CheckBox for a report parameter?
    thanx

    design ur parameters forms using forms and call ur report form there

  • How to make field is editable in ALV  CL_SALV_TABLE only)

    Hi,
    How to make field is editable in ALV  CL_SALV_TABLE only)
    Any one has tried to make field si editable by using CL_SALV_TABLE class.
    *I know how to do it in REUSEALV function module and CL_GUI_ALV class.*_
    Please reply only if you riedin CL_SALV_TABLE class method.
    Regards
    Rajesh V
    Moderator message: not supported, please read class documentation and search for previous discussions.
    Edited by: Thomas Zloch on Mar 17, 2011 2:07 PM

    Hi Chad,
    Please refer the link,
    Edit field in alv
    Regards,
    Hema.
    Reward points if it is useful.

  • How to make Date fields Editable or Non-Editable based on Call Staus

    Hi,
    We are using CRM2007 Web GUI for Service call creation. We are using date profile to populate the dates. Here my requirement is if call status is 'Call created' then some set of date fields to be appeared in display mode(Non Editable) and some set of date fields to be appeared in change mode(Editable). How to achieve this. Kindly suggest me.
    Regards,
    Steve

    Hello,
    Kindly check the following thread which is giving many solutions for your requirement:
    Re: how to make field non-editable (display mode)
    Kind regards,
    Nicolas Busson.

  • How to make a field editable, this field is dependent on a checkbox.

    Hi Frens,
    On the selection-screen of a report, i have a field and a checkbox in one block only.I want to make this field non-editable if the checbox is unchecked and if the checkbox is checked than, the field shouls be editable.
    Currently, it is happening but when i press enter after checking or unchecking the checkbox.
    How can we do it without pressing enter.
    Thanks and regards.

    Hi Anshul
    first describe your parameter like :
    PARAMETERS p_chkb AS CHECKBOX USER-COMMAND chkb.
    when user clicks on this checkbox
    the event  AT SELECTION-SCREEN OUTPUT. will be triggered without touching enter button.
    Than write a code like this to make P_OTHER parameter editable or non-editable :
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF screen-name EQ 'P_OTHER'.
          IF p_chkb EQ 'X'.
            screen-input = '1''.
          ELSE.
            screen-input = '0''.
          ENDIF.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    Hope it helps,
    Bulent
    Edited by: Bulent Balci on Jul 6, 2010 5:23 PM

  • How to make a column editable

    Hi all,
             I want a column to have checkboxes in my table where user can select at runtime.
    I added one colum to my table with Checkboxes.But the checkboxes are comming in non Editable mode.
    How to make them editable???
    My context structure is already binded to my table..now i added one ValueNode with One attribute and i binded that texts property of checkbox to the Valueattribute
    The cardinality of my ValueNode is 1..1 and selection is 0..1
    Regards
    Chandrashekar.

    Hi,
    when you added the checkbox as cell editor, then go to it's property:
    set "enable"  as true.
    set "readonly" as false.
    and create a boolean attribute "checked" in the table bode and bind it to the check box value property.
    And in the onAction of checkbox wirte the code to select or deselect the checkbox.
    and set the value as follows:
    wdcontext.nodeTable().getcurrentElement().setAttribuiteValue("checked", true);
    Regards,
    Praveen

  • How to make a pdf editable and save for print

    Hi,
    I just joined Adobe Cloud and it's been a while since I have used acrobat. I have made a brochure that I need a couple of things to be editable on. See below. I need the two areas highlighted in red to be editable for different locales/people. My questions are:
    A) I assume Acrobat is the way to do this. I also have FormsCentral if that works better. Can someone tell me how to make these two fields editable?
    B) What program do they edit with?  Acrobat Reader?
    C) How do they save and output it for print?
    Thank you,
    John

    This is not about what Acrobat can or can't do - and you just said they won't have it anyway. It's about the limitations of PDF. A proper solution is to develop (at some expense) a server side PDF generator that takes the user's input and makes them a custom PDF. I don't know if you can just subscribe to a service to do this. If you aren't going to have them use Acrobat, form fields are your only option. Be sure they (and you) understand the limitations and that they must use Reader (not one of the many other PDF viewers). Be sure you understand about reader enabling: many versions of Reader CANNOT SAVE filled in files unless they are specially prepared.
    So back to your original question: how do you make the fields editable: with the Forms function in Acrobat. You may have better luck in the Acrobat Forms forum.

  • How to make fields Non Editable in Web ADI

    Hi All,
    Can you please let me know how we can make fields Non Editable in Web ADI?
    Thanks,
    Anil

    Hi,
    Are you trying to make required parameters readonly and does this variable have different values for each row. If not then I would suggest you use a wrapper for the API and get only parameters that you need from the excel sheet and the use the wrapper to send the other read only values.
    Thanks

  • How to make background image editable in a template

    I have built a template and would like to make the background
    image editable, but not the rest of the settings in the body style.
    (I'm not sure of my terminology yet.) The background image is
    currently set in the locked part of the page. I've tried to insert
    an editable region in the html code, as I cannot get to the
    background image by clicking on it or selecting on the Design page.
    But I am not allowed to change the code in this way.
    What is the best way to do this? I'm not sure how to make a
    div of this one setting. Or even if that is what is needed.
    Thanks for any suggestions.

    So to give a different background image to different pages using CSS.
    Create a CSS file in your Dreamweaver site.
    Link it to your pages.(in your head tag like so: <link href="path/to/stylesheet.css" rel="stylesheet" type="text/css" />)
    In your HTML code find the body tag and give it an id (like so: <body id="myUniqueID">)
    In your stylesheet write the following code:
    #myUniqueID{
    background: #color, url("path/to/image.jpeg") repeat);
    And now extrapolate the above steps and code to your other pages and voila, you now have different background images for your different pages.
    To learn more about CSS - visit your local web search engine.
    To see the power of CSS, check out http://csszengarden.com/ where the exact same HTML file is styled by different CSS stylesheets.

  • How to make a checkbox bigger?

    I have the following code:
    var rushBtn = new sap.ui.commons.CheckBox("rushBtn", { text: 'Rush' });
    How can i make the checkbox bigger so that users can press it on mobile?
    Thanks,

    sap.ui.commons.CheckBox look like label.
    label use this CSS class
    .sapUiCb>label {
    background-image: url(img/checkbox.png);
    In this images all checkbox if you want bigger create new image and use it.
    How change CSS you can check this post CSS in SAPUI5 controls.
    Best Regards

  • How to make a checkbox tag functionable?

    i added a checkbox tag from insert menu......when i clicked on it......nothing happens.....i mean how to make it function like when i click on it .....it becomes checked.....and when i click it again it becomes unchecked.....the problem i face is nothing happens when i click on it....

    Checkbox is a form element.  Did you put it inside <form> tags? 
    <form action="form-processing-script.php">
    <label for="option1"> Option 1 </label>
    <input name="option1" type="checkbox" value="option1" />
    <label for="option2"> Option 2 </label>
    <input name="option2" type="checkbox" value="option2" />
    <label for="option3"> Option 3 </label>
    <input name="option3" type="checkbox" value="option3" />
    <p><input name="submit" type="submit" value="Submit" /> </p>
    </form>
    Option 1 Option 2 Option 3
    Nancy O.

  • How to make a checkbox as read-only ?

    Hi,
      My current requirement is to make a checkbox as read-only. Previously, the checkbox has been declared as
    PARAMETERS: cb_gr AS CHECKBOX DEFAULT 'X'.
    Now am required to make this as read-only. There are <b>no screens</b> defined in the report containing this checkbox and so am not knowing where to give the statement
    LOOP AT SCREEN.
    **Make the checkbox as disabled**
    ENDSCREEN.
    It is known that this statement has to be given in the PBO of a screen. So kindly guide me at the earliest on how to resolve this issue.

    Hi aISWARYA  ,
    Here is the Example for  making the report  parameter as  Read only  using the Report  Event  ,   Dont need and  screen Number for it , becuase  your selections itself is an Defualt 1000 screen which as   PAI & PBO , in which it maintains this Report Events in it  .
    "Change the Input Fields Dynamically in a Screen
    'The following example may help you:
    SELECTION-SCREEN BEGIN OF BLOCK 001.
    PARAMETERS: P_MRU  RADIOBUTTON GROUP SEL DEFAULT 'X' USER-COMMAND AC,
                P_PART RADIOBUTTON GROUP SEL.
        SELECT-OPTIONS P1 FOR <field> MODIF ID PRT.
        SELECT-OPTIONS G1 FOR <field>  MODIF ID MRU.
    SELECTION-SCREEN END OF BLOCK 001.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
      IF P_MRU = 'X'.
          IF SCREEN-GROUP1 = 'PRT'.
            SCREEN-INPUT = '0'.
          ENDIF.
          IF SCREEN-GROUP1 = 'MRU'.
            SCREEN-INPUT = '1'.
          ENDIF.
      ELSEIF P_PART = 'X'.
         IF SCREEN-GROUP1 = 'MRU'.
           SCREEN-INPUT = '0'.
         ENDIF.
         IF SCREEN-GROUP1 = 'PRT'.
           SCREEN-INPUT = '1'.
         ENDIF.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
    Reward points  if it is usefull .......
    Girish

Maybe you are looking for

  • Two column text wrap

    I'm using CS5 and I'm preparing a book that uses two columns. I have some photos that extend from one column into the other. When I wrap text around those photos one of the columns wraps fine but the other column does not. It wraps with a large white

  • Which item need to tax

    hi, in me23n line item conditions, there are 2 main value. net value(either base on standard or map item value) and effective value (also include of freight, duty) 1) may i know for both standard price and moving average price item, input tax during

  • [SOLVED]dhcpd: sharing internet connection from router to clients

    I can't seem to figure out (no wonderin, I am inexperienced with networking) how exactly you share an internet connection obtained by (authoritative?) router among a subnet of dhcpd clients? I was setting up pxe server (and i succeeded.. somehow) but

  • Document attachment won't open in pages

    I have installed pages on my iPad 2 and when I am emailed a document, PDF,doc,ppt, I don't have the option to open it in pages. The only option I get it to print it. Shouldn't I be able to move into pages from my mail program?

  • Netbeans is renaming files that it gets from the CVS (!)

    Hi; We have a file naming convention - looks something like this: TaskDefinition_UM-DoStuff.xml which is the file that contains the TD object: UM - Do Stuff I'm an Eclipse user, but one of our developers is using Netbeans. It appears that, when she b