How to fix the value of first column in the JTable in java swing for every

Hi ,
I have a swing page that have table panel in which there is a table of size 7x4 now when I click on the perticulat row then that row data will displayin the table like that the selected row become the second column in the new table and the fist column of this table will remain constant for all the entry but the second column update according to the roe which is selected .How it is possible .
Thanks in Advace,
anu

One thing you can do is to prevent the user from editing that column and programatically supply the values of that column yourself.
JTable table = new JTable() {
   public boolean isCellEditable(int row, int col) {
       if(col == 0) {
          return false;
       return super.isCellEditable(row, col);
};This allows you to prevent the user from editing the column information so you can supply some sort of a default value for the column always
ICE

Similar Messages

  • How to get all the values in one column of a JTable

    How to get all the values in one column of a JTable as a Collection of String.
    I don;t want to write a for loop to say getValueAt(row, 1) eg for 2nd column.

    I don;t want to write a for loop to say getValueAt(row, 1) eg for 2nd column. You could always write a custom TableModel that stores the data in the format you want it. It would probably be about 50 lines of code. Or you could write a loop in 3 lines of code. I'll let you decide which approach you want to take.

  • Calling multiple sub-reports based on the values in a column in the main report

    All,
    Say, I have a main report with 4 parameters and 8 columns in it's tablix, there is 1 column in this main report that can have 3 values, say A,B,C. If the user clicks on "A", he will be directed to Subreport A, clicks on "B", he will be
    directed to Subreport B and if he clicks on "C", then he'll be taken to Subreport C. All works fine when I call subreport A and B from that column, because both of them have the 4 parameters that we can map back to the parameters of the main report
    in the "Go To Report" section.
    Now, for Subreport C, I'll need to map all those 4 parameters + I will also need to map the parameters in my Subreport C to the FIELDS in the main report. Subreport C has 8 parameters, so 4 of them get mapped to the parameters of the main report and
    the other 4 get mapped to the fields in the main report.
    Now, when I call the Subreport C from my main report, that runs fine, but, I get an error when I try to call my other subreports A and B. The error says "Parameters in the subreport are not defined", probably because it tries to map the fields
    in the main report to the non-existing parameters in mu Subreport A and B.
    Any ideas/suggestions/workarounds would help a lot. Also, if someone can point me to a link where multiple subreports are being called from the column of a main report would be a great help too.

    One simple solution would be to add the additional 4 parameters to subreports A and B. Just don't use them.
    I assume you are calling the subrebort using Go to report action property of the tablix cell control. Try switching to Go to URL. Then use expression builder to dynamically create your url:
    ="http://YourReportServer/Reports/Pages/Reports.aspx?ItemPath=%2fYour%2fReport%2fPath%2fReport"+Fields!Column1.Value+"&Parameter1Name="+Parameters!Param1.Value+"&Parameter2Name="+Parameters!Param2.Value+"&Parameter3Name="+Parameters!Param3.Value+"&Parameter4Name="+Parameters!Param4.Value+IIf(Fields!Column1.Value="C","&Param5="+Fields!F1.Value+""&Param6="+Fields!F2.Value+""&Param7="+Fields!F3.Value+""&Param8="+Fields!F41.Value,"")
    Now this is a rather long formula which is why I prefer just adding the other 4 parameters to all of the subreports but this expression opens the report from the url and only when Column1 field is "C" does it also pass the additional 4 parameters.
    "You will find a fortune, though it will not be the one you seek." -
    Blind Seer, O Brother Where Art Thou
    Please Mark posts as answers or helpful so that others may find the fortune they seek.

  • How can I get the value of "Warehose" column in a form

    How can I get the value of "Warehouse" column in the form below (I mean what table that contain this value):
    Production Supervisor >> Batches >> (Button) Material Details >> (Button) Line Allocations
    Well, for more clearly! My problem is I must have the Unit Cost of Items, so I've got it in the cm_cmpt_dtl (table), but if I want to, I must create a relation that require 2 filed, they're Item_ID and Whse_Code.
    There's no problem with Item_ID, but Whse_Code seem to be the Mission Impossible (hix, I hate that film!!!!)
    I wonder if It was right to post this topic here. But anyway I just post my question here, hope I could get some help.

    wow, many, many, many.... and many thanks!
    Just add a tiny modify to check out the Batch_type
    doc_id = (select batch_id from gme_batch_header where batch_no='&batch_number' and batch_type = 0)
    Because the batch_no can be duplicated as we also create Batch and Filrm Planned Order.
    Many thanks for your support!
    P/S: Sorry for my terrible English :P

  • Update one column while getting the value in another column

    Is it possible to in one single SQL statement update two columns in a table while at the same time obtaining the value of another column, on the same row, in the same table, and independently (that is, the update of the columns has nothing to do with the data that I want from another column)*?* Of course, I can do this in two operations, one being a "select" and the other one being an "update", but since I am in the same table and even on the same row, is it really necessary to make TWO database calls? That's why I want to combine the the two SQL-statements, for reasons of presumed effiency.

    jsun wrote:
    Is it possible to in one single SQL statement update two columns in a table while at the same time obtaining the value of another column, on the same row, in the same table, and independently (that is, the update of the columns has nothing to do with the data that I want from another column)*?* Of course, I can do this in two operations, one being a "select" and the other one being an "update", but since I am in the same table and even on the same row, is it really necessary to make TWO database calls? That's why I want to combine the the two SQL-statements, for reasons of presumed effiency.Two statements != two database calls.
    At least not in terms of SQL.
    JDBC requires a 'statement' but in SQL (depending on the data source) that can include multiple statements. An obvious example of this is a stored proc but there are other ways as well.

  • How to get fourthly row (row4) first column value (col1) in matrix

    Hi to all,
    In FMS, how to get fourthly row (row4) first column value (col1) in matrix in document.
    select $[$38.1.4]
    But it display the first row
    Please give me hint.
    Thank you

    Hi Eric,
    FMS may only apply to current row.  There is no way to get any other fixed row.
    Thanks,
    Gordon

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • How to display the value of a column in a chart at the top of each column

    How to display the value of each column in a chart at the top of each column?

    Like this?
    Done using chart Inspector.
    For details, see Chapter 7,  Creating Charts from Numerical Data in the Numbers '09 User Guide. The guide may be downloaded via the Help menu in Numbers.
    Regards,
    Barry

  • How I can obtain the value of a column in a component table?

    thank you
    i have a table component, and which not bound a table database, it only display data, and i desire obtain the value of a column.
    thanks you sorry my english

    Hi!
    Try to use getValue(FieldKey fieldKey, RowKey rowKey) method of your dataprovider.
    Thanks,
    Roman.

  • How can I define that the value of a column should always be in UPPER case

    Hi,
    I want to make sure that the value in a column is always in UPPER case.
    Can we give this condition while creating or altering a table.
    A trigger can do it easily, but I was wondering if we could define a column to have values with upper case all the time, independent of what values are inserted. I mean if we give a lower case value in the insert statement, it should be converted automatically to upper case & stored.
    I want something like
    Alter table MY_TABLE Modify ( col1_upper varchar2(25) default UPPER(Col1_upper));
    But the above statement does not work as it references the col of the table.
    Thanks
    Sunil

    Well, you can put a check constraint on to prevent someone from putting lowercase data in:
    alter table my_table add constraint my_table_check_upper check (col1_upper = upper(col1_upper));However, I know of no way to modify the data being inserted/updated in a table without a trigger.
    Richard

  • How to load the value in target column?

    Hi
    Source: Oracle
    Target: Oracle
    ODI: 11g
    I have an interface which loads the data from source table to target. Some of the columns in the target tables are automatically mapped with source table. Some of the column remain un-mapped. Those who remain un-mapped, I want to load the values in that column by executing an query. So can anybody tell me where I should mention that query whose result would become the value of the specific column.
    -Thanks,
    Shrinivas

    You can put the query (or subquery) into the mapping field.
    You can also call a function in the mapping field which may be easier in your case.

  • How to calculate the sum of the values of some columns of a table

    hi
    i want to get in the column averages just the average of the values of some columns not all the columns of the table.what i have to change exactly in this block diagram.even if the size of the table is 25,i want the division to be the number of values in each column(= number of rows)
    just like that:
    Solved!
    Go to Solution.
    Attachments:
    operations on some columns.vi ‏10 KB

    i did exactely what u told me, i think i missed something because i don't get the average value of the rows i want
    Attachments:
    average.vi ‏11 KB

  • "How to get distinct values of sharepoint column using SSRS"

    Hi,
        I have integrated sharepoint list data to SQL Server reporting services. I am using the below to query sharepoint list data using sql reporting services.
    <Query>
       <SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction>
       <Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems">
          <Parameters>
             <Parameter Name="listName">
                <DefaultValue>{GUID of list}</DefaultValue>
             </Parameter>
             <Parameter Name="viewName">
                <DefaultValue>{GUID of listview}</DefaultValue>
             </Parameter>
             <Parameter Name="rowLimit">
                <DefaultValue>9999</DefaultValue>
             </Parameter>           
          </Parameters>
       </Method>  
    <ElementPath IgnoreNamespaces="True">*</ElementPath>
    </Query>
    By using this query, I am getting a dataset which includes all the columns of sharepoint list. Among these columns, I wanted to display only 2 columns (i.e Region and Sales type) using chart. I have created a Region parameter but when I click preview, the drop down box is giving me all the repeatative values of region like RG1,RG1,RG1,RG2,RG2,RG2,RG2,RG3.......... I wanted to display only distinct values of Region parameter so that whenever end user select region from the parameter drop down, it will display the respective value of Sales type column.
    Also when I select only RG1 parameter, it is giving me a chart including the sales type of all the Regions. (it should display me only the sales type of RG1) How can I link these 2 columns so that they will display the values respectively.
              I would really appreciate if anyone can help me out with this.
    Thanks,
    Sam.

    Hi Sam,
    By code, the CAML language doesn’t have any reserved word (or tag) to set this particular filter to remove duplicate results.
    In this case, we could use the custom code to get distinct records.
    Here are the detailed steps:
    1.         Create a hidden parameter that gets all the records in one field.
    Note: Please create another dataset that is same of the main dataset. This dataset is used for the parameter.
    2.         Create a function that used to remove the duplicate records.
    Here is the code:
    Public Shared Function RemoveDups(ByVal items As String) As String
    Dim noDups As New System.Collections.ArrayList()
    Dim SpStr
    SpStr = Split(items ,",")
    For i As Integer=0 To Ubound(Spstr)
    If Not noDups.Contains(SpStr(i).Trim()) Then
    noDups.Add(SpStr(i).Trim())
    End If
    Next
    Dim uniqueItems As String() = New String(noDups.Count-1){}
    noDups.CopyTo(uniqueItems)
    Return String.Join(",", uniqueItems)
    End Function
    3.         Create another parameter that will be used for filtering the maindata.
    Please set the available value to be =Split(Code.RemoveDups(JOIN(Parameters!ISSUE_STATUS_TEMP.Value, ",")), ",")
    And the default value to be the value you what such as the first value:
    =Split(Code.RemoveDups(JOIN(Parameters!ISSUE_STATUS_TEMP.Value, ",")), ",").(0)
    4.         Go to the main dataset. Open the property window of this dataset.
    5.         In the “Filters” tab, set the filter to be:
    Expression: <The field to be filter>
    Operator: =
    Value: =Parameters!Region.Value
    The parameter “Region” should be the parameter we created in the step3.
    Now, we should get distinct values of SharePoint columns.
    If there is anything unclear, please feel free to ask.
    Thanks,
    Jin
    Jin Chen - MSFT

  • Read From Measurement File... removes X Values of first column?

    During one of our tests, two instruments were switched at the terminal by accident. I need to read in the massive lvm files, remove the wrong scaling and apply the correct scaling, while switching the values in the columns and right it all to new files. Simple right?
    I wanted to use the Read from Measurement File.vi to make things easier, because the files are very large and I would like to analyze them 100 rows at a time. Some of the the files are around 1.5 Gigs in size so I need to read them in chunks.
    The read from measurement file keeps removing the first column from the data! It outputs the data as a signal (dynamic data) and I have to use the dynamic to numeric array express vi. For some reason, before I even get to that point, the first column is not in the data.
    No matter what settings I pick on the read from measurement express vi, the time column is removed from the data. I have checked/unchecked the "first row is channel names" and "first column is time channel" to no avail. The odd thing is that in the preview it shows the first column, as if it will read it properly... but it doesnt. Nothing I change in the settings can seems to make a difference in getting the first column, the x values, out of the file.
    Below you can see the first column completely removed from the data.
    This is extremely frustrating. By probing the signal out I can see the dynamic data attributes and the time column has already been removed, so I don't think that the signal to double array express vi is the problem, but I am not sure.
    I am attaching my VI and a small data file to be analyzed. You can see what I mean.
    The alternatives seem less than adequate. The read from spreadsheet file vi wants an offset of a specific number of characters not rows. The problem is that this is not constant between rows for some reason, when hidden characters are taken into account so I cant just set the number of characters in 100 rows and increment the offset in a loop... like I normally would. That means I might miss data or get a corrupted row.
    This means that I have to use the read from text file, read how ever many characters I think a row is (over estimating a bit) then search for the newline character, find out how many chars are in that set and then offset that for the next loop iteration, all while converting each string number to a double. Talk about slow.
    I have searched around and found that I am not the only one that has had this issue. This is a common thing, but no one seems to have the answer. Why can't the read from measurement file VI read all of the numbers in every row? Why cant I tell it I want a 2d array of doubles out and not a dynamic data type? It has to be something I am doing wrong.
    Attached is a zip file with my VI and two data files. The "S19_A_DSI_detensioning_c.lvm" is the one generated by my VI (_c meaning corrected). "S19_A_DSI_detensioning.lvm" is the original measurement file. I hope you will pardon my messy VI, it's a quicky.
    Any help you guys can give would be much appreciated.
    [will work for kudos]
    Attachments:
    Scaling Factor Correction.zip ‏1109 KB

    That is a great workaround. The help talked about putting a check next to "read lines" but for the life of me I couldn't find where to do that. I wonder what other VIs have mystery check options in the right mouse click menu. I mean normally options like those are inputs, I thought. I'm going to start right clicking on every VI I drop to see if there are options there I never realized.
    I would still have to use the set file position VI and specify the byte offset right? How would I know where that is? I guess each character is a byte and I would count the characters in the string retrieved and then offset by that amount on the next iteration using a shift register?
    While waiting for help, I ended up using the read from text file and using the match string to look for the new line character, and using the spreadsheet string to array vi, analyzed the files line by line. Thats just because I couldn't easily come up with a regular expression to get 100 lines. It was slow but it worked.
    However, that still really doesn't answer the question of why it is impossible to get the first column with the read from measurement file express VI. Does anyone know? Is this a known bug?
    [will work for kudos]

  • K-Bits (1) : Interchange the values of two columns

    Hi Everyone
    I wanted to get started a mechanism of knowledge sharing in the way of a series of threads called “K-Bits” (Knowledge Bits).
    In our day to day work, we learn some new things which can be useful for others. However we hardly get a chance to share it with others.
    Here is the opportunity to share your knowledge in the form of “K-Bits”.
    Here we start with the First Tip of this series.
    You might face a situation where you need to interchange the values of 2 columns in an Oracle database table. 
    E.g. there is a table employee having columns EMPID, FIRST_NAME, LAST_NAME and SALARY. By mistake the values of FIRST_NAME and LAST_NAME have been interchanged. Now you need to bring the data in correct state. 
    You can think about following few options: 
    Option-1_ 
    1.     Alter table employee and add a new column TEMP_NAME to it. 
    2.     Update the values of LAST_NAME to TEMP_NAME. 
    3.     Update the LAST_NAME with the values of FIRST_NAME. 
    4.     Update the FIRST_NAME with the values of TEMP_NAME. 
    5.     Drop the column TEMP_NAME. 
    Option-2 (For Oracle version 9i or higher)_ 
    1.     Alter table employee and rename LAST_NAME column to TEMP_NAME. 
    2.     Alter table employee and rename column FIRST_NAME to LAST_NAME. 
    3.     Alter table employee and rename column TEMP_NAME to FIRST_NAME.
    Probably you can go ahead with any other solution as well. However there is one very simple solution. 
    Option-3_ 
    Let do it by example: 
    DROP TABLE EMPLOYEE; 
    CREATE TBALE EMPLOYEE 
       EMPID             NUMBER 
      ,FIRST_NAME        VARCHAR2(30) 
      ,LAST_NAME         VARCHAR2(30) 
      ,SALARY            NUMBER 
    INSERT INTO EMPLOYEE VALUES (1,'Tendulkar','Sachin', 10000); 
    INSERT INTO EMPLOYEE VALUES (1,'Ganguli','Saurabh', 10000); 
    INSERT INTO EMPLOYEE VALUES (1,'Pathan','Irfan', 10000); 
    INSERT INTO EMPLOYEE VALUES (1,'Khan','Jaheer', 10000); 
    INSERT INTO EMPLOYEE VALUES (1,'Agarkar','Ajit', 10000); 
    INSERT INTO EMPLOYEE VALUES (1,'Dravid','Rahul', 10000); 
    SELECT * 
      FROM EMPLOYEE; 
    UPDATE EMPLOYEE 
       SET FIRST_NAME = LAST_NAME 
          ,LAST_NAME  = FIRST_NAME; 
    SELECT * 
      FROM EMPLOYEE;  The update statement above solves the purpose. Is not it simple? But how does it work?? 
    For any DML (Insert, Update or Delete) oracle internally fires the row level triggers. You can read more about triggers at 
    http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96524/c18trigs.htm
    and 
    http://download-east.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg13trg.htm#431 
    As you know in row level triggers the values of each column is stored in :OLD and :NEW parameters. For the above UPDATE statement oracle stores the old values of FIRAT_NAME and LAST_NAME in :OLD.FIRST_NAME and :OLD.LAST_NAME parameters respectively and then update FIRST_NAME with :OLD.LAST_NAME and LAST_NAME with :OLD.FIRST_NAME. 
    Regards
    Arun Kumar Gupta

    For any DML (Insert, Update or Delete) oracle internally fires the row level triggers.Any pointer to the documentation supporting this ?
    Edited by: Saubhik on Dec 7, 2010 5:58 PM

Maybe you are looking for

  • Can there be multiple accounts on one id?

    can there be multiple accounts on one id?

  • How to change the order of the songs in a playlist?

    I made a playlist of 26 songs. They are currently ordered alphabetically by artist, except, for some reason, what should be the first artist is actually the last. So in the number column, they are listed 1 to 26, and the artists are alphabetical. I d

  • File Dialog Box in the applet

    Hi... I am trying to make an JAVA applet in which i am trying to read the File through JFileChooser, so for that we need a dialog box to show up...right... when i run that applet from the JCreator environment, it does shows me that dialog box when i

  • Right Click Crashes MSOffice apps

    I just bought another Macbook Pro.  This time it is the 13" Retina.  Whenever I right-click on any MSOffice 2011 app (Outlook or Excel or Word) I get the beach ball and the program stops responding.  I have to force quite and re-open.  I'm wondering

  • Loading data into TimesTen

    Hi, We are looking into options that we have to load data into TimesTen. The data would be in data files. We are looking at three options -- Custom jdbc program, Custom PL/SQL procedure or ttBulkCp. Which would be a better option in terms of performa