Urgent : newly added columns copying each other

I am adding columns to jtable. And then moving it to required postion.
But whenever I edit those columns all the newly added columns and the first column reflects those changes. ie whatever I enter in the new columns, it appears in all newly added columns and the first column as well. I am using new instance of column each time so whats wrong I am doing here.
EditableHeaderTableColumn ncol = new EditableHeaderTableColumn();
TableColumnModel columns = table.getColumnModel();
int c = table.getSelectedColumn();
columns.addColumn(ncol);
columns.moveColumn(i-1, c+1);

the column header has a combobox and user can enter his own value as well if reqd.
I will check ur code at work later and see whats happenning.
But is editable header a problem?
thanks
to tjacobs01 : I didn't get your question. could you please elaborate a little.
What's you EditableHeaderTableColumn class do? Do you
allow the user to modify the column header value?
Anyway, here's an example that adds columns as you
appear to want to, check it oput ans see if there are
any steps you missed in your code.
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JTable;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JTextField;
import javax.swing.JScrollPane;
import javax.swing.JPanel;
import javax.swing.table.TableColumn;
import javax.swing.table.AbstractTableModel;
public class TableColumnTest
     static int sColumnCount= 4;
     public static void main(String[] argv)
final JTable table= new JTable(new
w AbstractTableModel() {
               public String getColumnName(int column) {
                    return "C" +column;
               public int getColumnCount() {
                    return sColumnCount;
               public int getRowCount() {
                    return 10;
               public Object getValueAt(int row, int column) {
                    return "(" +row +"," +column +")";
          final JTextField field= new JTextField("2", 2);
          JButton btn= new JButton("Add column at position");
          btn.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e) {
                    int position;
                    try {
                         position= Integer.parseInt(field.getText());
                    catch (NumberFormatException nfe) {
                         position= sColumnCount;
                    position= Math.min(position, sColumnCount);
                    field.setText(String.valueOf(position));
TableColumn column= new
new TableColumn(sColumnCount);
                    column.setHeaderValue(
                         table.getModel().getColumnName(sColumnCount));
                    table.getColumnModel().addColumn(column);
table.getColumnModel().moveColumn(sColumnCount,
nt, position);
                    sColumnCount++;
          JPanel panel= new JPanel(new BorderLayout());
          panel.add(btn, BorderLayout.CENTER);
          panel.add(field, BorderLayout.EAST);
          JPanel container= new JPanel(new BorderLayout());
          container.add(panel, BorderLayout.WEST);
          JFrame frame= new JFrame("TableColumnTest");
frame.getContentPane().add(container,
, BorderLayout.NORTH);
frame.getContentPane().add(new JScrollPane(table),
, BorderLayout.CENTER);
          frame.pack();
          frame.setDefaultCloseOperation(3);
          frame.setVisible(true);

Similar Messages

  • Newly added column not displayed in Interactive report

    Hello,
    I have a tableA with 3 columns.In the application i am displaying as Form with Report region as Interactive report(Oracle 10g Application Express 3.2).
    I added one column to tableA.Now when i am refreshing the report by adding that column in the select query,the new added column is not displayed in the application.
    How can i do this so that the added column can be displayed.I dont want to delete the whole thing and redo it again.
    Thanks
    Siya

    Hi Siya,
    The Interactive Report will not show you the newly added columns by default. You have to select those columns from the actions menu and when all the required fields are displayed then save it as the default report.
    Then you will be able to see all the columns.
    Hope this solves your problem.
    Thanks,
    Satish.

  • Newly added column not reversed by strand  reverse engineering

    Hi Guys,
    I have reverse engg a datastore from Oracle database and later I added one new columns in the same table at database level. Now when I am doing strand reverse Engineering from the model the newly added columns are not being reflected in ODI.
    please comment/advise.
    I want to do this through strand reverse Engineering.
    Thanks,
    Giri

    Appreciate if any one share suggestion/inputs on this issue

  • Specify the location for any newly added column

    Hi friends,
    Is it possible in Oracle to specify the location for any newly added column. why it always goes to
    the last , I want to add a new column at first.
    If it is possible and anybody knows please tell me.
    Thanks & Regards
    Chandrakishore Bankhede

    Hi Chandrakishore,
    Not exactly a spatial question but the answer is "no" as far as I am aware.
    TOAD for Oracle has a nice feature called "Rebuild Table" that provides a GUI interface for redefining and moving columns around. Basically it generates all the required DDL for you - it saves all the constraints, indexes, triggers, etc. Then it creates a new table with your changes, renames the old table with a suffix and replaces all the constraints, indexes, triggers on the new table. Most helpful.
    However - see this makes the post spatial in nature :) - for as long as I have been around this feature of TOAD has not been able to handle SDO_GEOMETRY columns - failing with "ORA-22917: use VARRAY to define the storage clause". The good news is the new TOAD 10 now is free of this bug.
    This is not meant to be a commercial for TOAD, I just don't know of any other product with this feature. Others may know of similar things perhaps or you can write a function yourself in PL/SQL.
    Cheer,
    Paul

  • Setting a Primary Key for a newly added Column

    Is it possible for setting a primary key for a newly added column in a table having records?

    Hi,
    km**** wrote:
    oh if the table has records then it is not possible ah...No, the table can have rows at the time you add the Primary Key constraint. Solomon was just saying that the column(s) that you are making into the Primary Key must already have unique values. A Primary Key can not be NULL, so you must do the steps in this order:
    (1) ALTER TABLE to add the column(s) (if this hasn't been done already)
    (2) UPDATE the table, to put unique values in all rows for the Primary Key column(s)
    (3) Add the PRIMARY KEY constraint
    You need to do step (2) before you do step (3)

  • How to insert data into newly added column

    Hi all,
    i am having a doubt how to insert entries into newly added column..
    i created a table with two columns and inserted the data into them then i altered the table by adding additional column.now i want to insert data into that..plz tell me how to do that..??
    thanks in advance..help me

    Small example:
    [email protected]> create table t(id int, id2 int);
    Table created.
    [email protected]> insert into t values (1,2);
    1 row created.
    [email protected]> insert into t values (2,2);
    1 row created.
    [email protected]> alter table t add id3 int;
    Table altered.
    [email protected]> select * from t;
    ID ID2 ID3
    1 2
    2 2
    [email protected]> update t
    2 set id3 = 10
    3 where id = 1;
    1 row updated.
    [email protected]> select * from t;
    ID ID2 ID3
    1 2 10
    2 2
    Best Regards
    Krystian Zieja / mob

  • Newly added column in a table not displayed in a related form

    I added a new column (DNAMECONT as varchar2) in a table I created a Form on. I added this new field in my Form as a text field, and on the customized tab of the form wizard, this following code is displayed as expected :
    <TR><TD><#DCONTRACTOR.LABEL#></TD><TD><#DCONTRACTOR.ITEM#></TD></TR>
    But I cannot view it once I run my form.
    did I forget to do something or is there something I did wrong?
    Thank you for your help.
    Bertrand

    Sorry to interupt, as far as I understand, if you add extra column to a table after the form is built and you want to add this new column in your form. When you add new item in your form, the name you give to the item should exactly match the column name of your new column of the table. Now, you said you added a new column called DNAMECONT, but the
    html shown in form wizard is <#DCONTRACTOR.LABEL#>, <#DCONTRACTOR.ITEM#>, two names do seem to match. Is that the problem?
    null

  • How to make newly added columns appear In IR report

    Hi.
    I am using APEX 4.0.1. I've created an IR report and then, subsequently, needed to add several column sto the underlying SQL query.
    When I save the changes, APEX tells me that it will add the new columns and that I need to run the IR report and either click "Reset" or use the Actions menu to make the new columns appear in the report. I did the latter and the new columns do appear just fine.
    However, when I then tried to modify the column labels, I am unable to see these in the report "Attributes" section. And so, I can't access their labels.
    How do I get the new columns to appear in the Attributes section of the iR report?
    Thanks in advance for any help.
    Elie

    Hi, LittleFoot (sorry, I don't see your actual name).
    Thanks very much for responding.
    I've done exactly what you've described.
    I added several new column sto the SQL query underlying the IR. I then re-ran the default Primary report, added the new columns via the Actions -> Select menus, and then saved the report.
    When I then go into the IR Attributes page, the new columns are not there. I've closed/re-opened my browser. I don't know what the issue is.
    I'm wondering ... would the fact that the underlying query is SELECTing from a view rather than a table make any difference? I wouldn't think it would.
    Thank you for any help.
    Elie

  • How can i map a newly added column in DB via aqualogic

    Hi,
    My application runs on aqualogic,
    Scenrio:
    It takes data from a table from one database, Say A and after integration it pushes the same data into another table in different DB, say B.
    Now I have added one new field in DB "A" and I have to insert that data of new field in a new DB "B".
    Please lemme know how can i do this.
    I have one xsd and ds file for both.
    If i manually write the entry in in both xsd's and ds's , and compile then will it be working fine.
    if not then whats the way to accomplish this task.
    Please help

    thanks michael,
    However, i manually add that field in my destination DB sxd file [worke fine] but when i added the corresponding entry in ".ds" file and did "ant build" its throwing the following error -
    [wlwBuild] [Build] </x:xds>] has been ignored. Error: error: Unexpected character encountered: 'x'.
    [wlwBuild] [Build] May 15, 2007 10:18:12 PM com.bea.ld.wrappers.Annotation$1 giveWarning
    [wlwBuild] [Build] WARNING: ANNOTATION WARNING: [ld:SamDataServices/DestDB/EIM_AGREEMENT.ds]: Unexpected pragma: [function <f:function xmlns:f="urn:annotations.ld.bea.com" nativeName="SAM_AGREE" nativeLevel2Container="DESTDB" style="table"/>] has been ignored. Was expecting one of pragmas: xds,xfl.
    can you please temme what could be the reason and how to overcoem it.
    PLUS:: i checked that this ds is a read only one ,, i checked out file ,, added entry manually .. removed read only tag .. and then again compiled ,,, again same error
    Your help will highly appreciated.

  • Adding column headings

    I am using RAS server to create dynamic columns in my report. But the column headings are not coming.
    Isnt there any way to set the heading for the newly added columns?   
    Any idea what i am missing?   
    Here is a code i am using
        Private Sub AddTableFromDataSet(ByVal ds As System.Data.DataSet, ByVal crTable As CrystalDecisions.ReportAppServer.DataDefModel.ISCRTable)
            ' Add the dataset as a data source to the report
            m_boReportClientDocument.DatabaseController.AddTable(crTable, DBNull.Value)
            m_boReportClientDocument.DatabaseController.SetDataSource(DataSetConverter.Convert(ds), "TEST")
            Dim ifield As Integer
            ' Add a field to the report canvas
            Dim CrField As CrystalDecisions.ReportAppServer.DataDefModel.ISCRField
            For Each dtfield In m_boReportClientDocument.Database.Tables(0).DataFields
                ifield = m_boReportClientDocument.Database.Tables(0).DataFields.Find(dtfield.Name.ToString, CrFieldDisplayNameTypeEnum.crFieldDisplayNameName, CeLocale.ceLocaleUserDefault)
                CrField = DirectCast(m_boReportClientDocument.Database.Tables(0).DataFields(ifield), Field)
                CrField.HeadingText = CrField.Name
                CrField.Description = "TEST"
                m_boReportClientDocument.DataDefController.ResultFieldController.Add(-1, CrField)
            Next
        End Sub
    Thanks in advance

    You either have to add the heading yourself, or you can use
    reportClientDoc.ReportDefController.ReportObjectController.AddByName("{Orders.OrderID}", "OrderID")
    This doesn't let you set anything about the objects, so it would probably be better to add them separately.

  • Discoverer 10.1.2 does not refresh new added column

    Hello,
    I need help to add a new item to EUL Business Area folder for a new added column in the database table.
    When I refresh the folder in the BA EUL, the result shows no difference between the folder and the underlying table in the database; however, when I quey the table in the database, a new column is there. The refresh of the folder in the Discoverer Admin tool cannot find the newly added column. Weird!! The first time saw this problem.
    Could someone shine some light on it? Would be really appreciate it!
    Ping

    I have a slightly different problem and can't solve it! When I refresh the EUL, the result shows the differences between the folder and the underlying tables in the database. However, it does not refresh the EUL in Discoverer Administrator 10g. Nothing happens! When I try to refresh again, the same list is shown... Does anyone know what could be happening?
    Thanks

  • SSAS Tabular - Adding Column to a table gives error "Object reference not set to instance of object"

    If I make changes to a table in SSAS Tabular Visual Studio, the newly added column gives error as "Object
    reference not set to instance of object"

    Hi VikasJain13,
    According to your description, you get the "Object reference not set to instance of object" error when adding columns in Tabular. Right?
    Generally, it throws this error when the internal code is accessing the property of an empty object. As you mentioned it happens when you make changes on a table, mostly it means that table is already a empty object. Please re-process your tabular to see
    if this table is still existing. 
    If you have any question, please feel free to ask.
    Simon Hou
    TechNet Community Support

  • Irritating problem with adding columns

    I am adding columns to jtable. And then moving it to required postion.
    But whenever I edit those columns all the newly added columns and the first column reflects those changes. ie whatever I enter in the new columns, it appears in all newly added columns and the first column as well.
    whats wrong I am doing here.
    EditableHeaderTableColumn ncol = new EditableHeaderTableColumn();
    TableColumnModel columns = table.getColumnModel();
    int c = table.getSelectedColumn();
    columns.addColumn(ncol);
    columns.moveColumn(i-1, c+1);

    Make sure you are not sharing the TableColumn instance or adding a TableColumn that already is in the TableColumnModel.
    When resizing the table column, do the others resize too. ?

  • Need help trying to arrange  3 fields all near each other..in  a region.

    I have 3 fields and i am trying to arrange all near each other..
    But i cannot
    The space is like
    Empno.. Fieldnename.....*empname*......................................fieldempname samplefield sampleno
    I am trying to understand why is there too much space between empname label and the field empname
    Note field empname is a list item.
    I have currently used field.= no and reduced the space difference
    Begin On New Line     Field      
    Can any one educate me more on what is a page item field yes or no indicate.
    What is the actual purpose of field in page item and also colspan and rowspan
    Also best method to arrange columns near each other in a apex form
    apex 4.1 11gxe
    Edited by: user12233760 on Oct 2, 2012 2:39 AM

    Hi I had forgotten this option of drag layout . One of the problem is. . I have 3 columns my third columns field
    is shown automatically at a different line . Though its label exist in the first line..This happen to last column dont know the reason why
    This is specially when i set my last field to no . so that it can exist in one cell..
    ..Ok Sorted it out..Went into documentation and found about start stop html tables. .and combination of all ..like field even yes,etc
    i am able to get the desired output Got it sorted thanks again
    Thanks again
    Edited by: user12233760 on Oct 2, 2012 3:15 AM
    Edited by: user12233760 on Oct 2, 2012 3:31 AM
    Edited by: user12233760 on Oct 2, 2012 3:33 AM

  • Document Set shared columns not propagated to documents newly added

    I have a Document Set with shared Managed Metadata and Person fields.
    I have found that sometimes some managed metadata fields are not propagated to newly added documents using drag and drop with Windows Explorer.
    [ Note : Sharepoint 2013 with SP1 ]
    Example
    Field A = Person or group (optional)
    Field B = Managed Metadata (optional)
    Step 1 :
    I create a new Document Set (lets call this one docset X), with field A empty and field B with a value.
    I save this docset then open the document library in Windows Explorer and finaly, drag and drop a document inside the folder of this newly created docset.
    When I look at the properties of the document, I found that there is no value in the field B even if it's not the case of the docset.
    Step 2 :
    I create another Document Set (lets call this one docset Z), and add a value inside field A and field B.
    Again, I save this docset then open the document library in Windows Explorer and finaly, drag and drop a document inside the folder of this newly created docset.
    When I look at the properties of the document, I found that there is a value in the field B and in the field A.
    Conclusion
    So it seems that the propagation of field B depends on if there is a value inside field A.
    It does not make sense.
    Any ideas ?

    Hi vinz,
    I tried many times and couldn't reproduce your issue in my environment(SP 2013+SP1), manged metadata field value in Docuemnt Set content item always could be propagated to documents dragged/dropped in this doc set folder via Windows Explorer regarding
    other fields value.
    You may try to test on other lists, site collections or web applications (may also test with new manged metada term store), see if this issue could be reproduced or isolate, the manged metada column value shouldn't be depend on other column value.
    Also check ULS log, see if there is any related error message generated when the document is dragged to the library windows explorer with this issue.
    http://blogs.msdn.com/b/opal/archive/2009/12/22/uls-viewer-for-sharepoint-2010-troubleshooting.aspx
    Thanks
    Daniel Yang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

Maybe you are looking for

  • Displaying an Image in an Excel Spreadsheet with JSP - URGENT

    Hi Peoples I can transfer the table I am using in to excel with JSP by doing: <%@ page contentType ="application/vnd.ms-excel" %> this works fine, though I have an image that sits within the table that I want to be displayed as well. Can this be done

  • How delet and replicate a vendor in SRM.

    Hi, Can any one help me whether a vendors BP number can be deleted using FM: BBP_BUPA_EVENT_DELE2 Actually I have updated the currency of my Vendor master record in the back end I want that to be replicated in SRM. only for a single vendor. Is there

  • Which computer to buy

    I am sure this topic is discussed over and over again, I am sorry for that.  I am not a real techy person, so I'm reaching out to you all for some thoughts.  I have a 2008 Mac Pro, and run Photoshop CC and Lightroom.  I don't do any video editing. I

  • HT1414 how do I restore my i pod when it has not been synced on computer ( computer was repaired and everything was erased)?

    How do I restore my ipod which is and iphone not in use. the ipod  has not been synced on the computer( computer was repaired and everything was erased)?

  • Accessing the Related components service

    Hi All, I installed the Related content component from stellent/oracle on the content server and works fine on the content server. Now I want to integrate this with my Front End. I am already using CIS APIs getFile and searchResults. I am trying to c