Refreshing new column headers problem

id like to change the column headers at any time, the number of columns dont change..just the headers, so i use a myDefaultTableModel.setColumnIdentifiers(myColumnNamesArray), it kinda works in that when i print out the actual JTables column headers..they reflect the changes...i just dont see them
DefaultTableModel dm = new DefaultTableModel(dataArray, colArray);
JTable table = new JTable(dm);
...to change..
dm.setColumnIdentifiers(newColArray);
dm.fireTableChanged(new TableModelEvent(tableModel,TableModelEvent.HEADER_ROW));at this point if i do a
System.out.println(table.getColumnName(0-n));i can see that the actual table has the changed column names. what am i missing? i tried
dm.fireTableDataChanged();
dm.fireTableStructureChanged9);but that didnt do anything either :)
any help??

cuz just setting and repainting doesnt work for me :(Is it a programming problem or version problem?
I can't tell, which is why you should always post your test program. A test program is not that hard to create. The following works for me on JDK1.4.2:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class TableHeaderChange extends JFrame
     public TableHeaderChange()
          final DefaultTableModel model = new DefaultTableModel(5, 3);
          JTable table = new JTable(model);
          JScrollPane scrollPane = new JScrollPane( table );
          getContentPane().add( scrollPane );
          JButton button = new JButton("Change Header");
          button.addActionListener( new ActionListener()
               public void actionPerformed(ActionEvent e)
                    String[] columnNames = {"One", "Two", "Three"};
                    model.setColumnIdentifiers( columnNames );
          getContentPane().add(button, BorderLayout.SOUTH);
     public static void main(String[] args)
          TableHeaderChange frame = new TableHeaderChange();
          frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
          frame.pack();
          frame.setVisible(true);
}Problem solving always works better when you simplify the problem.

Similar Messages

  • 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

  • Discoverer Export Problem - Column headers dropped & row data used instead

    In Discoverer 9i, when I export the data for a 12 month period from one of my workbooks to Excel 2002, three of the twelve column headers are dropped in the spreadsheet and one piece of row data is used as a column header instead. The total number of records exported for the workbook is 33586 which is below the export limit for Excel. This problem does not happen when 11 months of data (28174 rows) is exported out to Excel. Any idea what may be causing this?
    Regards,
    Andrew

    pallen,
    As usual the Express VI has its limitations.  It seems to be setup for a 2D array of info in this case.  The best way I've found is to name range in template and use the Excel Easy Table.vi.

  • Problem while inserting new Column in JTable

    Hi,
    I am facing Problem while inserting new Column in JTable.
    I have a JTable with one inherited ColumnModel class.
    When I am adding the column and moving towards the corresponding location, it moves successfully.
    but if I am adding another column or making any changes to table column structure the table retains the defualtcolumn structure.
    please help me to solve this..
    Regards
    Ranjith.........

    Maybe this example will help:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=579527

  • Problem with rule file ,not able to create  a new column

    I am trying to create a text temp in column 53 and trying to join with another column54.A new column temp is created but some filelds are blank instead of temp.I donot understand why it is happening like this ,what is the reason behingd this .
    Thanks

    Check out the following thread..
    Re: SLD forbidden access
    Your user id has to be assigned to the group JDI.develeopers
    Regards
    Krupa
    Message was edited by: Krupakar Oleti

  • Problem in adding the new column in VO : ADF

    Hi,
    I am using jdev 10.1.3.2 with ADF.
    I added a new column in a table in the database. In my ADF application, I right clicked on the entity object of the changed table, and selected ‘Synchronize with DB’ which added the new column in the entity object also.
    I had a jsp which uses this view object’s (VO). I had to change the VO also to add this new column.
    After all this, in the jsp page, I dragged and dropped this new column as an input text field.
    But while running this page, the field is empty. Also when I drag and drop it, this field doesn’t have the ‘id’ attribute.
    Below is the code. Please let me know how I can fix this issue.
    <af:inputText value="#{bindings.RebillNumber.inputValue}"
    label="#{bindings.RebillNumber.label}"
    required="#{bindings.RebillNumber.mandatory}"
    columns="#{bindings.RebillNumber.displayWidth}">
    <af:validator binding="#{bindings.RebillNumber.validator}"/>
    </af:inputText>
    Thanks,
    Venki

    Hi Venki,
    Please check if the object on the page is bound to the same iterator as the other components. Sometimes dragging and dropping new attributes makes JDev create a new iterator, and the two iterators will not be in sync.
    You can check this in the pageDef file and correct any strange things you may find.
    Jeroen van Veldhuizen

  • Refreshing the Physical Layer ( New Columns)?

    Hi,
    I am new to OBIEE. (11.1.1.5)
    I have a physical layer defined and now I have added some additional columns to these tables in the database.
    Now, How to get these new columns reflected in the Physical layer.
    I tried the Tools -> Utilities -> Update Physical Layer.
    But it only checks for the data types of the existing columns already in the Physical layer.
    Please help.
    Edited by: 937825 on Jul 16, 2012 6:46 PM

    Use File->Import Metadata option
    The tables and column which are in RPD are grayed out and which are not available are in black.
    Pls mark correct or helpful if helps

  • How to make column headers in table in PDF report appear bold while datas in table appear regular from c# windows forms with sql server2008 using iTextSharp

    Hi my name is vishal
    For past 10 days i have been breaking my head on how to make column headers in table appear bold while datas in table appear regular from c# windows forms with sql server2008 using iTextSharp.
    Given below is my code in c# on how i export datas from different tables in sql server to PDF report using iTextSharp:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Data.SqlClient;
    using iTextSharp.text;
    using iTextSharp.text.pdf;
    using System.Diagnostics;
    using System.IO;
    namespace DRRS_CSharp
    public partial class frmPDF : Form
    public frmPDF()
    InitializeComponent();
    private void button1_Click(object sender, EventArgs e)
    Document doc = new Document(PageSize.A4.Rotate());
    var writer = PdfWriter.GetInstance(doc, new FileStream("AssignedDialyzer.pdf", FileMode.Create));
    doc.SetMargins(50, 50, 50, 50);
    doc.SetPageSize(new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.LETTER.Width, iTextSharp.text.PageSize.LETTER.Height));
    doc.Open();
    PdfPTable table = new PdfPTable(6);
    table.TotalWidth =530f;
    table.LockedWidth = true;
    PdfPCell cell = new PdfPCell(new Phrase("Institute/Hospital:AIIMS,NEW DELHI", FontFactory.GetFont("Arial", 14, iTextSharp.text.Font.BOLD, BaseColor.BLACK)));
    cell.Colspan = 6;
    cell.HorizontalAlignment = 0;
    table.AddCell(cell);
    Paragraph para=new Paragraph("DCS Clinical Record-Assigned Dialyzer",FontFactory.GetFont("Arial",16,iTextSharp.text.Font.BOLD,BaseColor.BLACK));
    para.Alignment = Element.ALIGN_CENTER;
    iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance("logo5.png");
    png.ScaleToFit(105f, 105f);
    png.Alignment = Element.ALIGN_RIGHT;
    SqlConnection conn = new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
    SqlCommand cmd = new SqlCommand("Select d.dialyserID,r.errorCode,r.dialysis_date,pn.patient_first_name,pn.patient_last_name,d.manufacturer,d.dialyzer_size,r.start_date,r.end_date,d.packed_volume,r.bundle_vol,r.disinfectant,t.Technician_first_name,t.Technician_last_name from dialyser d,patient_name pn,reprocessor r,Techniciandetail t where pn.patient_id=d.patient_id and r.dialyzer_id=d.dialyserID and t.technician_id=r.technician_id and d.deleted_status=0 and d.closed_status=0 and pn.status=1 and r.errorCode<106 and r.reprocessor_id in (Select max(reprocessor_id) from reprocessor where dialyzer_id=d.dialyserID) order by pn.patient_first_name,pn.patient_last_name", conn);
    conn.Open();
    SqlDataReader dr;
    dr = cmd.ExecuteReader();
    table.AddCell("Reprocessing Date");
    table.AddCell("Patient Name");
    table.AddCell("Dialyzer(Manufacturer,Size)");
    table.AddCell("No.of Reuse");
    table.AddCell("Verification");
    table.AddCell("DialyzerID");
    while (dr.Read())
    table.AddCell(dr[2].ToString());
    table.AddCell(dr[3].ToString() +"_"+ dr[4].ToString());
    table.AddCell(dr[5].ToString() + "-" + dr[6].ToString());
    table.AddCell("@count".ToString());
    table.AddCell(dr[12].ToString() + "-" + dr[13].ToString());
    table.AddCell(dr[0].ToString());
    dr.Close();
    table.SpacingBefore = 15f;
    doc.Add(para);
    doc.Add(png);
    doc.Add(table);
    doc.Close();
    System.Diagnostics.Process.Start("AssignedDialyzer.pdf");
    if (MessageBox.Show("Do you want to save changes to AssignedDialyzer.pdf before closing?", "DRRS", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation) == DialogResult.Yes)
    var writer2 = PdfWriter.GetInstance(doc, new FileStream("AssignedDialyzer.pdf", FileMode.Create));
    else if (MessageBox.Show("Do you want to save changes to AssignedDialyzer.pdf before closing?", "DRRS", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation) == DialogResult.No)
    this.Close();
    The above code executes well with no problem at all!
    As you can see the file to which i create and save and open my pdf report is
    AssignedDialyzer.pdf.
    The column headers of table in pdf report from c# windows forms using iTextSharp are
    "Reprocessing Date","Patient Name","Dialyzer(Manufacturer,Size)","No.of Reuse","Verification" and
    "DialyzerID".
    However the problem i am facing is after execution and opening of document is my
    column headers in table in pdf report from
    c# and datas in it all appear in bold.
    I have browsed through net regarding to solve this problem but with no success.
    What i want is my pdf report from c# should be similar to following format which i was able to accomplish in vb6,adodb with MS access using iTextSharp.:
    Given below is report which i have achieved from vb6,adodb with MS access using iTextSharp
    I know that there has to be another way to solve my problem.I have browsed many articles in net regarding exporting sql datas to above format but with no success!
    Is there is any another way to solve to my problem on exporting sql datas from c# windows forms using iTextSharp to above format given in the picture/image above?!
    If so Then Can anyone tell me what modifications must i do in my c# code given above so that my pdf report from c# windows forms using iTextSharp will look similar to image/picture(pdf report) which i was able to accomplish from
    vb6,adodb with ms access using iTextSharp?
    I have approached Sound Forge.Net for help but with no success.
    I hope anyone/someone truly understands what i am trying to ask!
    I know i have to do lot of modifications in my c# code to achieve this level of perfection but i dont know how to do it.
    Can anyone help me please! Any help/guidance in solving this problem would be greatly appreciated.
    I hope i get a reply in terms of solving this problem.
    vishal

    Hi,
    About iTextSharp component issue , I think this case is off-topic in here.
    I suggest you consulting to compenent provider.
    http://sourceforge.net/projects/itextsharp/
    Regards,
    Marvin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Incomplete List of Values in Interactive Report Column Headers

    Oracle Database 11g 64-bit
    Apex 3.1.1.00.09
    I created an interactive report that results in over 10,000 records, and several of the columns have incomplete filter values when you click on the column header. It's not even close in some instances. It's not even showing the values that are loaded in the visible page.
    I have tried recreating the report on a new page, as well as creating a database view with the query and then just querying the view (in case there was a problem with query complexity).
    I'm at my wits end as to why this is happening. Have any of you seen this happen, and is there any way to get around it? I know I can write my own LOV query for the column headers, but those won't be dynamic like they are supposed to be out of the box taking applied filters into account.
    Thanks in advance.

    Tim,
    Did you find a solution to this. I have the same problem.
    Cheers
    Yog

  • Column Headers of Masterdata Query

    Hello experts,
    in a Masterdata Query based on an InfoObject there are many Attributes.
    These Attributes are now listed in the Rows of the Query:
    InfoObject
    Attribut 1
    Attribut 2
    Attribut 3
    Therefore the Query will look like this:
    InfoObject        Attribut 1      Attribut 2     Attribut 3    
    Company A     New York     USA            Industry
    Company B     Toronto         Canada       Healthcare
    Company C     Mexico City   Mexico        Industry
    Now the problem is, that the real column headers are very long (60 chars) and therefore the column with is too wide so that the report shown in Web Reporting is far too wide.
    Question: How can the column header be separated into 2 or more lines so that each column will not be so wide?
    I know that this can be done with Keyfigure-Column-Headers .... unfortunately the report is based on Attributes (chars) of the InfoObject and not on Keyfiugres.
    Thank you for your help!
    Angie

    The following did the trick for the header lines only:
    Note 1292696 - Analysis modification: Fixed column width and line break
                                <bi:MOD_SELECT type="CHOICE" value="MOD_GENERIC_MODULE" >
                                    <bi:MOD_GENERIC_MODULE type="COMPOSITE" >
                                        <bi:MOD_REFERENCE value="com.sap.ip.bi.rig.ColumnWidth" />
                                        <bi:MOD_PARAMETER_LIST type="ORDEREDLIST" >
                                            <bi:MOD_PARAMETER type="COMPOSITE" index="1" >
                                                <bi:MOD_PARAM_NAME value="COLUMN_DEFAULT" />
                                                <bi:MOD_PARAM_VALUE type="CHOICE" value="INTEGER" >
                                                    <bi:INTEGER value="75" />
                                                </bi:MOD_PARAM_VALUE>
                                                &lt;
                                            </bi:MOD_PARAMETER>
                                            <bi:MOD_PARAMETER type="COMPOSITE" index="2" >
                                                <bi:MOD_PARAM_NAME value="WRAPPING" />
                                                <bi:MOD_PARAM_VALUE type="CHOICE" value="BOOLEAN" >
                                                    <bi:BOOLEAN value="X" />
                                                </bi:MOD_PARAM_VALUE>
                                            </bi:MOD_PARAMETER>
                                        </bi:MOD_PARAMETER_LIST>
                                    </bi:MOD_GENERIC_MODULE>
                                </bi:MOD_SELECT>
                            </bi:MOD_SINGLE_MODULE>
                        </bi:MODIFICATION>

  • Column Headers Keep Changing

    Many times now I've had to change the column headers that appear over emails only to have them change back to something else.
    I click VIEW > COLUMNS and then put a check next to the ones I want to display like FROM, SIZE, ATTACHMENTS etc. Then I rearrange the order they will appear in by dragging the headers to the left or right in the viewer window.
    When I come back to the mailbox later, the view has reverted to what it was before.
    Any ideas? I don't think it's a sync issue with my other computer (which is doing this too) because I only use sync for Keychain and iCal, not Mail. I use IMAP and get my mail through Google Apps. Does the problem trace back to Google's control panel?
    I want to LOCK the way column headers appear and be done with it!
    Thanks.

    Yes it worked, thanks a lot. here is my code
    Dim mydate As DateTime, str1 As String
    Dim datevalue As Date
    Dim columns As DataGridViewColumn() = New DataGridViewColumn(6) {}
    For i = 0 To columns.Length - 1
    Dim col As DataGridViewColumn = New DataGridViewTextBoxColumn()
    Dim DateSunday As Date = Now.AddDays(-1.0 * CDbl(Now.DayOfWeek))
    mydate = DateSunday.AddDays(+i)
    datevalue = mydate
    str1 = mydate.DayOfWeek.ToString
    col.HeaderText = str1 & " " & mydate.ToString("d")
    columns(i) = col
    Next
    Me.DataGridView1.Columns.AddRange(columns)

  • JTable -showing column headers and displaying multi-line strings

    Hi,
    This is two questions really.
    #1 - Does anyone know why my column headers aren't showing in my jtable using the model below?
    #2 - Does anyone know how I can display, mulitple line strings in a jtable? Currently my newline character ('\n') is just being displayed as a character.
    any help very much appreciated,
    Tom
    private class TaskHistoryTableModel extends AbstractTableModel {
    private List taskHistory = new ArrayList();
    public Object getValueAt(int row, int col) {
    if (col == 0) {
    return ((TaskHistoryItem) taskHistory.get(row)).getText();
    } else {
    return ((TaskHistoryItem) taskHistory.get(row)).getDate().getTime();
    public int getRowCount() {
    return taskHistory == null ? 0 : taskHistory.size();
    public int getColumnCount() {
    return 2;
    /** Getter for property taskHistory.
    * @return Value of property taskHistory.
    public List getTaskHistory() {
    return taskHistory;
    /** Setter for property taskHistory.
    * @param taskHistory New value of property taskHistory.
    public void setTaskHistory(List taskHistory) {
    this.taskHistory = taskHistory;
    public String getColumnName (int col) {
    return col == 0 ? "Text" : "Entered At";
    public boolean isCellEditable(int row, int col) {
    return false;
    }

    fixed my own problem - make your mulit-line string into html format e.g.
    this string will appear on two lines in a jtable
    "<html><p>A much more interesting entry</p> <p>on multiple lines</p></html>"

  • How to add new columns in materialized view

    We are using Oracle 10g Release2.
    We need to add new columns to a prebuilt fast refresh materialized view. We want to add 4 new columns in this table and make them part of select statement in the materialized view. We can drop the view but we cannot do complete refresh after that because the paymentsInfo table has a creation_timestamp column which is populated by before row insert trigger with systimestamp. If we did the complete refresh, all values in this column shall be changed.
    CREATE MATERIALIZED VIEW  paymentsInfo
    ON PREBUILT TABLE
    REFRESH FAST
      ON DEMAND
      START WITH SYSDATE
      NEXT SYSDATE+5/1440
      WITH PRIMARY KEY
    DISABLE QUERY REWRITE AS
    SELECT PAYMENT_ID,BATCH_REFERENCE, TRANSACTION_REFERENCE, NO_OF_TRANSACTIONS, DEBIT_ACC_NUM,... from payment@dblink
    I want to know is there any other way to add new columns without losing any changes from the master table.
    Thanks.

    There is no way to add new Columns to Materialized view. To add new columns, it has to be dropped and re-built again.
    Extract from Oracle Documentaion:
    Use the ALTER MATERIALIZED VIEW statement to modify an existing materialized view in one or more of the following ways:
      To change its storage characteristics
      To change its refresh method, mode, or time
      To alter its structure so that it is a different type of materialized view
      To enable or disable query rewrite
    If you have a problem of Complete refresh, then It may be beneficial to get the backup of the MView; Drop and re-create it with modified definition; Restore the backup data leaving the new columns untouched (assuming they are to be kept as fetched from the Master site).

  • Best approach to publish new table or new column on existing table on MDW?

    Hi,
    I'm refering to Olite R3 without any patches. I don't use Java API, I use MDW.
    if I have a new table or a new column on a existing table, what's the best approach to publish it?
    I'm asking this because I've trying lots of approaches and the only solution was, step-by-step:
    1) On MDW, drop the publication item
    2) Add again the publication item
    3) Associate the publication item to the publication
    4) Save everything
    5) File / Deploy (if I don't do it, it does not work)
    6) Tools/Package... (that's where it's a problem: if I don't remove the app and create it again it does not work!)
    7) on the client side, I perform a msync with "force refresh"
    That's the only way I found to publish new items for sure. Any other action does not push the new table or new column to the client's embbeded DB.
    Any comments?
    Regards,
    Maurício Américo Vernaschi.

    I do not use MDW, rather a mix of java and the final publish step you use, but
    Adding new PIs should be easy, just add them and re-publish (no need to drop anything)
    for changes, if you just have new columns and the sql statement is 'select * from' then you should just need to make the changes in the base schema objects, and run the publish with no changes and the updates should be picked up. If selecting specific columns, then update and re-publish.
    When using MDW at the end you can save the application as a jar file, and then use this jar file to publish in the mobile manager - this is the best wayto publish.
    Have a look at this jar file in winzip, and you will find it contains a web.xml file. This is the xml definition of the publication items, and for simple changes it is possible to just edit this file and republish via the mobile manager

  • New Columns in Extend VO

    Hi,
    I'm new with the OAF Technology and i be glad for some help...
    My requirement is to add to date fields on region related to VO and EO.
    The new dates fields need to be saved in DFF Attributes in the appropriate table.
    So i did following:
    1. Extend the vo - check that the DFF attributes exists in the EO,add 2 columns in the vo Query, remap the new columns to the correct Eo attributes.
    2. Personalization - Add to items to the region and connect them to the VO Attributes.
    The vo Extention works good it select data and saved data.
    But my problem is with the dates!!!
    after saving the values goes wrong...
    if for example i entered '10-Dec-2007 11:33:48' after saving or even refresh is become '2007-12-10 11:33:48.0'.
    So my question is How/Where do i need to treat the dates???
    The New VO Attributes Type is string.
    The Page New Item type is DATETIME defined by personalization.
    I already tried to :
    1. Change the VO Attributes typ eto Date but when i mapp it to the correct EO attribute is return it to String(DB Col defined as VARCHAR2).
    2. Add some code in my Extend VORowImpl in the attribute set method:
    String s = this.getAttribute("Attribute1").toString();
    setAttributeInternal(ATTRIBUTE1, value);
    but is seems that it not refer to it.
    Please Help me with that ...
    Thanks,

    user606697 ,
    How r u capturing date on the page? and setting to DB. Are u using oracle.jbo.domain.Date both in capturing and setting in db , or ur type casting date class in ur code progrmatically.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • How to export data from a Oracle table to a delimited file?

    I know how to load delimited file into a table, but how to export data from a Oracle table to a delimited file? Thanks in advance.

  • File System Error

    Hi guys I reali need help with my bb 8520...had it 4 almst 4mnths now been workin fine all the time but now suddenly I can't download anythin orh take pix at all....if I do any of those it will show me file system error nd cancel my download nd with

  • Not getting cleared with internal working of JSF

    Hi All, I have started with basics of JSF and created some simple apps using netBeans. However I am not getting cleared with the exact internal working of JSF i.e. how the things are implemented in JSF libraries: jsf-api and jsf-impl. Please advice o

  • Speed Up Photoshop (and Everything) With SSD

    'Tis the season to spend money. FYI, today on Amazon.com you can get a ridiculously fast 256GB OCZ Vertex 4 SSD drive for only $159.99, which is an unprecedented low price for a drive of this capacity. http://www.amazon.com/OCZ-Technology-2-5-Inch-In

  • Corporate Corporate Exchange server sync contact issue

    Corporate Corporate Exchange server sync procedure works as it should except : When I go to Contact Groups menu all of my contacts from the exchange server are now at the top, in the 'Not Assigned' area. For normal contact use this does not seem to b