How to disable moving Columns in JTable

Hi,
How can I make sure that the columns in my JTable cannot be moved?
Any ideas?
thanks

How about:myTable.getTableHeader().setReorderingAllowed(false);

Similar Messages

  • How to disable certain columns of a Table?

    hi all,
    I wish to fill a pattern of 8 digital signals (only 1's & 0's) in a Table.
    Is there any way to restrict the user from typing char or num other than a 1 or a 0?
    Since the table is a string, I'm having confusion how to do this.
    Secondly, the table would have by default 12 columns visible on the Front Panel, excluding both the headers.
    But the No. of Columns is based on a parameter called Duration that ranges between 4 & 256.
    What I want the user to do is to key in 1's & 0's for the Duration chosen.
    Since it'll be tedious to key in for large values of Duration, I've given the option of Set Row(s) & Reset Row(s),
    that will fill with either 1 or 0 respectively for the chosen Row Value.
    Is there any way to disable the remaining columns of the Table, ie, those unfilled columns,
    when the user scrolls horizontally? I don't know how to achieve this.
    I went thro' the Properties of the Table, I don't understand some of their functionalities,
    like SelStart, SelSize etc.
    I wonder why a Property like Disable Array Elements for Arrays is not provided for a Table
    to Disable the columns we want to do so, or is it my gross ignorance, I don't know.
    Experts pls clarify me & help me out.
    Regards,
    Partha.
    - Partha
    LabVIEW - Wires that catch bugs!
    Attachments:
    Set Eventframe1.vi ‏409 KB

    Another option is to do this:
    Slightly more elegant, but also more potential for bugs (e.g. the users can tab into the column).
    craigdobis wrote:
    You can lower your overhead by using these "professional" looking indicators and controls. They are limited in functions and properties, thereby causing a smaller VI in file size.
    Nice. I didn't think about that. Looks like a VI with a single system boolean takes ~20% less space than one with a standard boolean.
    P.S. In general, I would say there are considerably better arguments for using system controls than memory issues.
    Try to take over the world!
    Attachments:
    Disabled Column.png ‏5 KB

  • How to disable a column in matrix

    Hi All,
                How to make a column in matrix disable in runtime...this is the coding iam using...but iam unable to find to disable that column.
    Dim objWasType As EditText
    objMatDet = objForm.Items.Item("MatDet").Specific
    objWasType = objMatDet.Columns.Item("col_3").Cells.Item(pVal.Row).Specific
    <--i want like this option,but it doesn't have that property-->
    ''objWasType.Disable =true
    <--i want like this option,but it doesn't have that property--> 
    Regards,
    shangai.

    hi petr,
               i don't want to disable the matrix....only i want to disable a particular column in matrix on the selection of one combobox event.....
    Ex:-In a combobox '2' selections are there & in matrix ''2'' columns are there...if 1st selection(in combobox) is selected then in the matrix second column should be disabled & if 2nd selection(in combobox) is selected then in the matrix first column should be disabled.
    i have tried this line...
    objMatDet.Columns.Item("col_1").Editable= False
    but after this change it work fine....thenagain next time when i stop the debug mode of my project & again when i run my project the '2' columns are ALWAYS UNEDITABLE....(i,e the change occured has became constant)...is there any solution ot make the fields uneditable only on the selection event....
    regards,
    shangai

  • Disable first Column in jTable

    Hello people my problem is I use jTable and in the table I need to disable first column so that the user is not able to change edit the values that are listed in this column. Please help me with some code samples if possible. Thanks in advance.

    A custom table model makes this simple. You just override the isCellEditable method and return false when the column index is 0.

  • How to disable a column in Advance Table

    Hi All,
    I have an advance table, for which one of the column is MessageTextInput I want to disable this column programatically on certain condition for a particular row, is this should be implemented by switcher else is there a better way.
    Thanks in advance

    switcher is the best way to implement this problem.
    You can also use SPEL expression, which is very easy to implement.
    Eg,
    Set the SPEL expression for readOnly property as ${ReadOnlyFlag} // where readOnlyflag is a boolean attribute in the VO of respective region.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to disable a Column for a particular row in Advanced Tables

    Hi All,
    We are using an Advanced Table for search criteria. Our requirement demands to disable a column (we are using messagechoice item in that column) for only first row. We use standard Add Another Row functionality to add the rows.For the remaining rows it (message choice) should be enabled. Can anyone help me to solve.
    Regards,
    Sundeep

    You can either use a Switcher or OADataBoundVariables for this.
    Please see the section OADataBoundVariable in the dev guide. Based on certain View Attribute value, you can set the specific column in the table as Read Only.
    Switcher can be very similar too. Decide an Attribute for the Switcher and make sure the first row (which you want to disable) has some specific value. All other rows should have some other value. Decode can help you here. Then you would need to create two cases. Under the specific to first row, have a read only item. For the other case, have an enterable item. A little read through of the Switcher chapter in the Dev guide would clarify the doubts if any.
    Regards
    Sumit

  • Moving columns in JTable

    hi all
    i'm having a slight problem after i've moved a column within my JTable, i need to reallocate the column index numbers. i'm using a sorter for the data, so when i move a column and select another column (or that one) it sorts a different column to the one selected based on the original (pre-move) indexes ( i do hope that makes some sense).
    i have a mouseDragged listener which works fine when moving a column, i just now need to add the index changes for all columns to it but i keep coming up with very very bad code that doesn't work.
    any suggestions would be most appreciated.
    thanks heaps...
    Takis

    i've actually been fiddling with those and that is actually where my problem lies.
    i use the following:
    int viewColumn = columnModel.getColumnIndexAtX(e.getX());
    int column = tableView.convertColumnIndexToModel(viewColumn);
    the sorter then works on "column".
    problem is, that when the column is moved, the viewColumn changes, but the column value remains the same. i've also tried sorting on the view column but then it gets even more confused.
    i just can't seem to figure it out...
    Takis

  • Moving Columns in Jtable. Columns not in sync with header

    Hi,
    I got several tables within a scrollPane. So I use the add method on the scrollPane to add them. In order to see the headers I add the header separately :
    add(table.getTableHeader());
    add(table);
    The problem is the following :
    When I am moving my Column around, the header moves around, however the columns don't move ! So The header does not correspond anymore to my column !
    Do someone have some ideas how to get ride of that problem ?
    Thanks
    Emmanuel

    One thought: Add the tables to another container, such as a JPanel and then add the panel to the JScrollPane

  • How to disable entire row in JTable?

    Hi to all,
    I have a JTable where i added JCheckboxes to single column.
    The Checkboxes automatically increments when new row is added.
    My problem is that i need to disable the row of which the checkbox is selected.
    when i used
    setEnabled(false);
    the entire column is disabled.
    plz any one can help me out.
    Thanks In advance.

    Override JTable#isCellEditable to return false for the row.
    db

  • How to set a column in JTable non-editable?

    I have a JTable, and how can I set a particular column non-editable?
    Thank you.

    You could create a sub class of DefaultTableModel, you pass the column number to the constructor or you add a method like setColumnEditable(0, false); to set column 0 non-editable.
    You overwrite the method isCellEditable so it will return false when the column number that is passed to the method is 0 (if you want to have column 0 non-editable).

  • How edit/focus/resize columns of JTable that is node of JTree?

    I have added a JTable as a node on a JTree, but now I can't interact with it. I think that it is because all mouse/selection actions are grabbed by the JTree. However, I can't figure out how to pass these on to the table.
    What method do I call? I can't seem to find a way to get which column I have clicked over, and even if i did, i can't find a method to actually select it!
    please help!

    Hi,
    your questions I had got some time ago, and I solved the problem . It means you will as well.

  • How to disable some "columns to display"?

    Hello!
    I have one management pack (it's monitor some our network devices), which was written by contractors for our company. This mp have many unnecessary columns in it's view. I deleted some of these <ColumnInfo> 
    from mp (.xml file). Then I import mp but these columns
    have not disappeared.
    Can anybody help me? What should I do to remove these columns?
    P.S. I know that I can disable them with "Personalize view", but I want to do it
    centralized (all of the console users must see these changes).

    Hi,
    Since the MP was written by contractors, it is better to contact them edit the column.
    Meanwhile, after importing the management pack, please re-create monitor for
    a test.
    Niki Han
    TechNet Community Support

  • How to hide the column in JTable

    Hi
    I want to hide a column . But I would be needing the data in that column. ( I have 4 columns )
    I want to hide 4th column
    I have done these steps
    MyTableModel  myTableModel= new  MytableModel(t);
    myTable  = new JTable(myTableModell);                 
    mTable.getColumnModel().removeColumn(myTable.getColumnModel().getColumn(3));When I trying to read the column 1 value it is giving the exception
    myTable.getValueAt(row,3).toString();It is giving the arrayboundexception
    Can anybody tell me what is the correct method to do ?
    Thanks and regards
    Anshuman

    Thanks for reply .
    I have taken the value as the convertRowToModel
    WalterLaan wrote:
    You get an exception because the table doesn't have a column at index anymore, but you can still ask the model.
    table.getModel().getValueAt(table.convertRowToModel(row), 3);
    But it is giving the same error
    java.lang.ArrayIndexOutOfBoundsException: 4 >= 4
         at java.util.Vector.elementAt(Unknown Source)
         at javax.swing.table.DefaultTableColumnModel.getColumn(Unknown Source)
         at javax.swing.JTable.convertColumnIndexToModel(Unknown Source)
         at javax.swing.JTable.getValueAt(Unknown Source)Edited by: techie_india on Jul 6, 2009 10:38 PM

  • How to disable row of a jtable

    hi,
    i am making an application in which i have jtable what i wants to do is that i am selecting row and inserting the values of this row into another jtable now what i wanst is to disable the already selected row so that i can not be selected again.
    Thanks in advance.

    You never bother replying to your old postings to thank people tor the suggestions given, so I won't bother making any more suggestions.

  • How to disable arrow keys in JTable.

    Hi ,
    I'm using Jtable and when pressing shift + arrow keys the rows get selected. I want to avoid this situation.
    Thanks
    Manjula

    This posting shows how to remove a default Action;
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=657819

Maybe you are looking for

  • WRT160N - problem with on-line games and downloading

    Hi, Several months ago I bought a WRT160N router and I have a strange problem. When I play online games, such as QL, and someone else will start downloading from the Internet, from time to time about 10 sec I have 999 ping I turned on in the backgrou

  • How to keep JRE updated on clients

    I deal with multiple clients, and it's a real pain trying to keep Java updated. In particular the users don't have administrative access, so they can't update directly. Those I give administrative access to updatet will usually install the various to

  • Standard report for GL

    Hello, Can any one let me know in case do we have any standard report for GL accounts which will be according to the country wise and bifurcated according to the profir center. Please let me know incase If there is any report available along with the

  • Controlling the size of the 'proxy' movie?

    I'm working with a bunch of 4K material.  I ingested it into FCPX, thinking I was going to get HD or 1280 or something ... but the proxy files are 2K.  Is there somewhere deep in the bowels of FCPX that I can set the proxy movies to be a smaller form

  • Image problem in Dreamweaver Please Help!

    I have attached an image in dreamweaver and it looks fine when I preview it in the browser but when it put it on the hosting site it is not there. What should I do?