Disable cells at runtime

Hi,
I have a JTable with 5 columns. Out of which I have 3 columns with checkboxes.
Column1 || Column2 || Column3 || Column4 || Column5
Cell1 (CheckBox) || Cell2 (CheckBox) || Cell3 || Cell4 || Cell5 (CheckBox)I have a checkbox outside this table. And on selecting the checkbox, I need to disable all the cells in a row except for the first cell.
I am inserting data into the row using addRow() and I am using "new Boolean(false) to add the checkbox to a cell.
I do not know how to disable these cells, any ideas?
Mathew

Override the isCellEditable(...) method of JTable or TableModel.

Similar Messages

  • Disable cell editing

    Hi.
    Can I disable cell editing in a JTable without using a TableModel and still let the user click on different cells?
    /lars

    You can subclass JTable and override isCellEditable().

  • JTable - disable cell editing for whole table

    I need to know how to disable cell editing for the whole of a JTable. Is there an easy way of doing this??

    you can do it very easy :)
    just override AbstractTableModel's isCellEditable(int row, int col) function
    and return false is ok.
    Hope this helps!

  • IsCellEditable() to disable cell editing for specific columns

    Hello experts:
    My SSCCE for this question is at the below link:
    http://forum.java.sun.com/thread.jspa?threadID=5293914&messageID=10244030#10244030
    My question is how do I disable cell editing for all but the "Price" column of my table in the SSCCE. I tried adding the below lines of code right after creating the JTable. But get compilation errors.
    //Here is the block of code that I am trying to include.
         @Override                                                       
         public boolean isCellEditable(int row, int col) {     
         if (col == 7) {                                                  
                   return true;
              } else {
                   return false;
         } //Below is the method in detail03.java showing the block of code added
    private JScrollPane BuildEmptyTable() {
         model = new DefaultTableModel();
         model.addTableModelListener( this );
         model.setColumnIdentifiers(new String[] { "SKU","Qty", "Price"});
            tblDetailTest = new JTable(model);
         @Override                                                       
         public boolean isCellEditable(int row, int col) {     //     <----- I tried placing the
         if (col == 7) {                                        //                  the code block here
                   return true;
              } else {
                   return false;
         tblDetailTest.setRowHeight(20);
         tblDetailTest.setPreferredScrollableViewportSize(new Dimension(900, 100));
         JTableHeader tblHdr = tblDetailTest.getTableHeader();
         tblHdr.setBackground(Color.yellow);
         JScrollPane scrollPane = new JScrollPane(tblDetailTest);
         return scrollPane;
    }Can somebody please guide me? Thank you very much.

    oops!
    Sorry, my bad! I did not tell you what I tried. Following your suggestion, I made the following 2 changes to the code:
    In the method, BuildEmptyTable(), where I build the table structure, I have the following statement:
         tblDetail = new JTable(model){
    public boolean isCellEditable(int row, int col) {
           return col == 8;
    };And in a separate method after the table is populated with data, I have the below code:
         tblDetail.getModel().addTableModelListener(new TableModelListener() {
         public void tableChanged(TableModelEvent e) {
         if (e.getType() == TableModelEvent.UPDATE)
              int row = e.getFirstRow();
              int column = e.getColumn();
                 if (column == 8){
                   //code here
                   System.out.println("Updating item price!");
         }I do understand that the message gets displayed as many number of times equal to number of rows inserted into the table, because of the UPDATE event. But my problem is I do not know how to make a code change to do what I exactly want, as I have indicated in my previous note. Meaning I want the listener to be called only when the
    data in the editable cell changes.
    Thank You.

  • Switching off location services disables cell service?

    Is this right? If I switch off location services, I cannot send or receive cell phone calls. Basically switching off location services is the equivalent of putting my phone in airplane mode?
    I'm using an iPhone 5 with the current iOS.
    Thanks.

    No, it's not right. Turning off location services should not be the same thing as putting the device in Airplane mode. Airplane mode turns off all of the radios (wifi, cellular, BT and GPS). Turning off location services doesn't disable cellular or, rather, it shouldn't in a properly working phone. I'd start with the standard troubleshooting steps.
    Best of luck.

  • Disabling controls at runtime

    Jdev 11.1.2.3.0
    ============
    I am having problems on what I want the user to see at runtime. I want to use controls (command buttons, etc) to control what a user will be able to see depending on the situation. My scenario is described in the following points:
    1) I have a page template (jsf) and have created other jsf pages as adf regions which uses the page template. When a user clicks on button to navigate to any of the adf page regions, I l want to disable some of the controls on the page template. That is, the command buttons, menus and other controls will be visible but when a user clicks on it, it will not respond.
    2) Just like the above, when a user is in a page (jsff), I want at runtime, to disable or render some of controls invisible either by a click of a button or before the page starts.

    Create VO based on SQL "select 1 dummy from dual"
    Create new attribute by using "New" option in the attributes section. Make it always updatable and boolean type and call it ShowCreateUserFlag and put the default value to true
    Drag VO data control on the page as table , but make it rendered false, since you really interested in the binding of this VO and not presentation
    on "Create User" button set the value of "rendered" property to binding of ShowCreateUserFlag.AttributeValue
    When you do some operation you get getCurrentRow() of VO, getAttribute("ShowCreateUserFlag") and set it's value to Boolean.False.
    Sorry if it is still not clear. I am writing it from memory

  • Disable Cell Broadcast Alerts on Lenovo S90A

    hi,
    I have purchased Lenovo S90-A 
    i am getting cell broadcast alerts every 20 mins.. i.e 30-50 alerts/day
    it is working on andriod 4.4.4
    pls help me in disableing that option
    Regards,
    Shashank
    Solved!
    Go to Solution.

    Hi shashankjos16
    Have you tried the solution from Message 2 (refers to a different model but the setting/option should be similar)
    Regards.
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as ''ACCEPT AS SOLUTION"! 
    Unsolicited PM's will not be answered! ....Please post your question/s in the appropriate forum board.
    English Community   Deutsche Community   Comunidad en Español   Русскоязычное Сообщество

  • Disable tabs at runtime (WebDynpro Java - tab strip)

    I have a tab strip view set and want to disable the navigation to some embedded views at runtime.
    Tab 1 contains a view for selecting items. If the selection does not return any values from
    the database I want to disable tab 2 ("the user shall not be able to select tab 2).
    Any idea how I could do this?
    Regards FW

    Use a TabStrip and ViewContainerUIElements instead of a view set. Then you can disable tabs dynamically via the Tab.enabled property.
    Armin

  • Visual Composer Disabled Cell

    Dear Gurus,
    I have an output table where an input field is Editable (users are able to enter values and send the entire table values to an DSO in BI. This part works fine). However I would like to Disable a cell based in a condition (ex. @ACTIVA<@NUM3 OR @DESATIVA<@NUM3). I am not able to do that. Or all fields from this table are Editable or not. Is it possible to disable just a cell?
    Kind Regards
    Gilson Teixeira, Brazil

    Hi Gilson,
    Why don't you try to duplicate your table and make the desired column of the first table editable and left the same column of the second table read-only?
    Then configure the visibility condition according on your rule.
    Hope it helps.
    Regards,
    Alessandro Reichert.

  • Disable button at runtime

    Hi
    I have created a button in my View. I wish if i could disable this button at runtime using some coding in view editer.
    How can i access this bottun from coding and then how can i disable it.
    Thanks.

    Hi
    1)Create an value attribute say buttonDisable of type Boolean
    2) Bind the value attribute to the ENABLE property of the button
    in you code use
    in your wdDonInit() add this line , to default your button state
    wdcontext.current<>element.setButtonDisable("False"); / true
    wdcontext.current<ABC>element.setButtonDisable("False");  -- to enable the button
    wdcontext.current<ABC>element.setButtonDisable("true"); -- to disable the button
    Best Regards
    Chaitanya.A

  • Disable Cell of Tree Component

    I want to add a property to the rows/cells of Tree component,
    by which I can enable and disable the clicking of the rows. Any
    idea?
    Thanks in advance
    Ankur Arora

    Haven't tried this, but its an idea:
    Tree inherits from the List class...
    so you have itemRollOver and itemRollOut events which lets
    you know the index of the item
    and a selectable property (at the level of the list (or tree
    in this case), not for a specific cell or index)
    so, you could listen for itemRollOver and set the selectable
    property of the Tree based on whether the index that you rolled
    over is supposed to be selectable or not.
    Like I said, I haven't tried it.

  • Maintenance View - Disable cells

    Hi All,
    This is my requirement for the maintenance view. I am using this view as part of cluster view.
    I have around 6 key fields for this view. 3 of them are subset fields. But 2 key fields have a lot of combination of values. Hence, we want the user to make an entry for these key fields. I set these fields as input fields in the layout.
    One of the remaining key field appears as display only column.
    On load, i get the data from a BAdI and populate the rows with these 2 keys fields as editable.
    On Save, i save all the records (with values in these editable key fields or initial values). But, now i want to disable entry into these key fields for the saved records.
    How can i do this?
    Regards,
    Rekha

    Hi,
    look into this thread
    Re: SM30 - disable certain rows for editing
    in this thread see the reply from Venkat.
    If you want to disable all the previous entries from editing, write the logic in PBo module like in the thread.
    Regards,
    Selva

  • How to disable RichCommandButton at runtime

    Hi,
    I need to disable RichCommandButton known as "Submit" located on a popup.
    As you know the pop up closes by itself if we click Submit or Cancel buttons. But in my case it stays for a while to complete a upload file logic (atleast 3 to 5 sec) written in a managed bean.
    In the mean while I don't want the user to click the submit button for the second time.
    I tried to set the setDisabled property of the submit button to true. But this disables the submit button when I invoke the popup for second time.
    Can any one help me on this?
    Thanks,
    Sandeep

    Hi Sandeep,
    If there is a "Blocking" attribute on the button, try setting it to true on design time. That should block user inputs until the upload is complete.
    Regards,
    Chan Kelwin

  • Merge cells  at runtime in Adobe Form

    Help.
    I have 6 columns in  a table .
    I need to write a script in adobe form to check the value of the 5th column
    if  5th column = 'T' then I need merge 1th,2th,3th columns
    If  5th column = ' ' then do nothing
    I write JavaScript
    data.#subform[0].TABLE.DATA::initialize
    if ( this.COLUMN5.rawValue == "T" )
    this.COLUMN1.colSpan = "3" ;
    The cell's merged  but not correct. In the row with  column = 'T'   appear the new columns.

    Well you are on right track. Just use the code in your first post and second post for complete solution.
    I tried with a simple table with 1 row and below is the JavaScript code I used in the initialize event of Subform:-
    Table1.Row1.Cell5.rawValue = "T";
    if(Table1.Row1.Cell5.rawValue == "T")
         Table1.Row1.Cell1.colSpan = "3" ;
         Table1.Row1.Cell2.presence = "hidden";
         Table1.Row1.Cell3.presence = "hidden";

  • IPhone 5 as GPS unit - disable cell service?

    I want to use my iPhone 5 as a GPS unit when I'm out in the mountains and I don't want my phone to keep searching for service and running down the battery. Is there a way to turn off everything (including phone service, not just data) except the GPS? I'd like something like airplane mode but still be able to use GPS. Thank you!

    No, the iPhone uses the cell signal to accelerate determining your position. Once the phone can connect with 3 satellites it will be able to determine your location...but...you will need to buy a mapping program that stores its maps on your iPhone instead of accessing them through cell data or WiFi. Like Garmin, or TomTom, or...more in the App Store.

Maybe you are looking for