JTable column headers not displaying using custom table model

Hi,
I'm attempting to use a custom table model (by extending AbstractTableModel) to display the contents of a data set in a JTable. The table is displaying the data itself correctly but there are no column headers appearing. I have overridden getColumnName of the table model to return the correct header and have tried playing with the ColumnModel for the table but have not been able to get the headers to display (at all).
Any ideas?
Cheers

Class PublicationTableModel:
public class PublicationTableModel extends AbstractTableModel
    PublicationManager pubManager;
    /** Creates a new instance of PublicationTableModel */
    public PublicationTableModel(PublicationManager pm)
        super();
        pubManager = pm;
    public int getColumnCount()
        return GUISettings.getDisplayedFieldCount();
    public int getRowCount()
        return pubManager.getPublicationCount();
    public Class getColumnClass(int columnIndex)
        Object o = getValueAt(0, columnIndex);
        if (o != null) return o.getClass();
        return (new String()).getClass();
    public String getColumnName(int columnIndex)
        System.out.println("asked for column name "+columnIndex+" --> "+GUISettings.getColumnName(columnIndex));
        return GUISettings.getColumnName(columnIndex);
    public Publication getPublicationAt(int rowIndex)
        return pubManager.getPublicationAt(rowIndex);
    public Object getValueAt(int rowIndex, int columnIndex)
        Publication pub = (Publication)pubManager.getPublicationAt(rowIndex);
        String columnName = getColumnName(columnIndex);
        if (columnName.equals("Address"))
            if (pub instanceof Address) return ((Address)pub).getAddress();
            else return null;
        else if (columnName.equals("Annotation"))
            if (pub instanceof Annotation) return ((Annotation)pub).getAnnotation();
            else return null;
        etc
       else if (columnName.equals("Title"))
            return pub.getTitle();
        else if (columnName.equals("Key"))
            return pub.getKey();
        return null;
    public boolean isCellEditable(int rowIndex, int colIndex)
        return false;
    public void setValueAt(Object vValue, int rowIndex, int colIndex)
    }Class GUISettings:
public class GUISettings {
    private static Vector fields = new Vector();
    private static Vector classes = new Vector();
    /** Creates a new instance of GUISettings */
    public GUISettings() {
    public static void setFields(Vector f)
        fields=f;
    public static int getDisplayedFieldCount()
        return fields.size();
    public static String getColumnName(int columnIndex)
        return (String)fields.elementAt(columnIndex);
    public static Vector getFields()
        return fields;
}GUISettings.setFields has been called before table is displayed.
Cheers,
garsher

Similar Messages

  • JTable column is not displaying in JPanel

    I created a JTable with single column like
    New JTable(celldata, columndata);
    and added it into JPanel. In this case only table cells are displying but not the column. If I use JScrollPane, table column name does displyed.
    Any help would be appreciated.
    Thanks
    Satheesh

    That is the correct behaviour of the components. A table won't display the column headers unless it's in a JScrollPane. Though you can get the headers from the table yourself manually using getTableHeader and put them where you want.

  • JTable column headers not showing up

    I have a JTable inside a JScrollPane which, in turn, is inside a JTabbedPane.
    I created a TableModel which extends AbstractTableModel as per the java Swing Tutorial examples.
    In that model is an Object[][] object for the data called rowData, and all the data displays in the table perfectly.
    I also have a String[] object called columnNames to define the column headers. ..the column names are coded directly into the object.
    i.e.: String[] columnNames = {"John", "Janet", "Jamie", "Jennifer"};But the column names don't display at all.....all I get in the column headers is 'A', 'B', 'C', etc.
    I need to know either
    1)how to set this up correctly in the first place or
    2)how I can reset the columns manually.
    I have tried adding the table 2 ways..as follows...but neither one gets the headers right:
    JScrollPane jScrollPane = new javax.swing.JScrollPane(getTable());or
    JScrollPane jScrollPane.setViewportView(getTable());Note: getTable()..is where the new javax.swing.JTabel(new TableModel())stuff is done.
    thx, ESW

    You mentioned the you columnNames array. I suggest you declare it as static and accessible from within your custom table modelprivate static final String[] COLUMN_NAMES = {"John", "Janet", "Jamie", "Jennifer"};Then you override/implement the following methods in your TableModel :public String getColumnName(int column) {
         return COLUMN_NAMES[column];
    public int getColumnCount() {
         return COLUMN_NAMES.length;
    }That should do the trick.

  • Using custom table model with the Net Beans JTable

    I am using the net beans editor to create an application. For the JTable that net beans provides, I would like to use my own Table Model instead of the default one that is provided. How do I specify to the form editor that I want to use my own TableModel instead of the DeafaultTableModel?

    I am using the net beans editor to create an application. For the JTable that net beans provides, I would like to use my own Table Model instead of the default one that is provided. How do I specify to the form editor that I want to use my own TableModel instead of the DeafaultTableModel?

  • JTable Column Names Not Displaying

    Hi there
    I create a JTable by passing the JTable constructor my custom TableModel which extends AbstractTableModel.
    For column names I have a String[] containing the column names in my custom TavleModel and have coded the TableModel methods accordingly.
    For some reason when I run the code the table is displayed, but the column names are not!?!
    Any advance is appreciated!

    Sorted!
    After looking at sample code in the JTable tutorial, it seems the table likes/needs to be added to a JScrollPane, as once I did this the column headings started appearing.
    e.g. JScrollPane scrollPane = new JScrollPane(table);

  • JTable Column Headings not displaying

    Hi
    I have recently made a Jtable a node of a Jtree.
    My table shows (semi-correctly) and is editable.
    I can't seem to see the headings of each column. and the left hand border line of the table is missing.
    Anyone know why this is?? I presume that I cant resize my columns due to the fact I cant see the headings.
    Thanks
    mike

    If you don't want to put the table in a scrollpane you can put it on a JPanel too...but use the BorderLayout and add the table to the center and the tableheader to the North portion.

  • Custom table model, table sorter, and cell renderer to use hidden columns

    Hello,
    I'm having a hard time figuring out the best way to go about this. I currently have a JTable with an custom table model to make the cells immutable. Furthermore, I have a "hidden" column in the table model so that I can access the items selected from a database by their recid, and then another hidden column that keeps track of the appropriate color for a custom cell renderer.
    Subject -- Sender -- Date hidden rec id color
    Hello Pete Jan 15, 2003 2900 blue
    Basically, when a row is selected, it grabs the record id from the hidden column. This essentially allows me to have a data[][] object independent of the one that is used to display the JTable. Instinctively, this does not seem right, but I don't know how else to do it. I know that the DefaultTableModel uses a Vector even when it's constructed with an array and I've read elsewhere that it's not a good idea to do what I'm trying to do.
    The other complication is that I have a table sorter as well. So, when it sorts the objects in the table, I have it recreate the data array and then set the data array of the ImmutableTableModel when it has rearranged all of the items in the array.
    On top of this, I have a custom cell renderer as well. This checks yet another hidden field and displays the row accordingly. So, not only does the table sort need to inform the table model of a change in the data structure, but also the cell renderer.
    Is there a better way to keep the data in sync between all of these?

    To the OP, having hidden columns is just fine, I do that all the time.. Nothing says you have to display ALL the info you have..
    Now, the column appears to be sorting properly
    whenever a new row is added. However, when I attempt
    to remove the selected row, it now removes a seemingly
    random row and I am left with an unselectable blank
    line in my JTable.I have a class that uses an int[] to index the data.. The table model displays rows in order of the index, not the actual order of the data (in my case a Vector of Object[]'s).. Saves a lotta work when sorting..
    If you're using a similar indexing scheme: If you're deleting a row, you have to delete the data in the vector at the INDEX table.getSelectedRow(), not the actual data contained at
    vector.elementAt(table.getSelectedRow()). This would account for a seemingly 'random' row getting deleted, instead of the row you intend.
    Because the row is unselectable, it sounds like you have a null in your model where you should have a row of data.. When you do
    vector.removeElementAt(int), the Vector class packs itself. An array does not. If you have an array, when you delete the row you must make sure you dont have that gap.. Make a new array of
    (old array length-1), populate it, and give it back to your model.. Using Vectors makes this automatic.
    Also, you must make sure your model knows the data changed:
    model.fireTableDataChanged(); otherwise it has no idea anything happened..
    IDK if that's how you're doing it, but it sounds remarkably similar to what I went thru when I put all this together..

  • Custom JTable column (JCheckBox) not included in row selection.

    I am trying to use JCheckBox (for display only data) as one of my JTable columns. I have written custom cell renderer for the same. Every thing is working fine except that when I select a row, the new custom JCheckBox column is not included in selection. Here is the code that I am using.
        protected class CheckBoxColumnRenderer extends DefaultTableCellRenderer {
            JCheckBox ckb = new JCheckBox();
            public Component getTableCellRendererComponent(JTable table, Object value,
                        boolean isSelected, boolean hasFocus, int row, int column) {
                if (value instanceof Boolean) { // Boolean
                  ckb.setSelected(((Boolean) value));
                  ckb.setHorizontalAlignment(JLabel.CENTER);
                  ckb.setBackground(super.getBackground());
                  if (isSelected || hasFocus) {
                      ckb.setBackground(table.getSelectionBackground());
                return ckb;
        }How can I include the custom cell in the row selection.
    regards,
    nirvan.

    they have lots of dependencies and it is not always easy to strip out an SSCCE without a considerable effort.Exactly. And is the cause of the problem the dependencies or something else. The only way to know for sure is to strip out the code and simplify the problem, that way you truly understand what the problem is.
    The majority of time this can be done with minimal effort as in this case.
    Some times we are sure that the problem is with certain part of the code Is the problem the code or the way the code is invoked? How do we know the TableModel is created properly or that the column class is overwritten correctly when we can't see it?
    someone having a third look at it may actually find the enhancement required with ease.Exactly, but we need to see the big picture.
    So are you sure that I should post an SSCCE with every possible question where coding is involved ?In the majority of cases a SSCCE is easily created in 5-10 minutes, so if you want the fastest help then yes.
    Just twice this past week I was ready to ask a question on the forum and was preparing a SSCCE to post and sure enough both times the creation of the SSCCE caused me to look at the problem differently and I solved it. I would much rather solve a problem on my own then post a question and wait for hours (days) hoping someone else knows the answer.

  • JButton in JTable with custom table model

    Hi!
    I want to include a JButton into a field of a JTable. I do not know why Java does not provide a standard renderer for JButton like it does for JCheckBox, JComboBox and JTextField. I found some previous postings on how to implement custom CellRenderer and CellEditor in order to be able to integrate a button into the table. In my case I am also using a custom table model and I was not able to create a clickable button with any of the resources that I have found. The most comprehensive resource that I have found is this one: http://www.java2s.com/Code/Java/Swing-Components/ButtonTableExample.htm.
    It works fine (rendering and clicking) when I start it. However, as soon as I incorporate it into my code, the clicking does not work anymore (but the buttons are displayed). If I then use a DefaultTableModel instead of my custom one, rendering and clicking works again. Does anyone know how to deal with this issue? Or does anyone have a good pointer to a resource for including buttons into tables? Or does anyone have a pointer to a resource that explains how CellRenderer and CellEditor work and which methods have to be overwritten in order to trigger certain actions (like a button click)?
    thanks

    Yes, you were right, the TableModel was causing the trouble, everything else worked fine. Somehow I had this code (probably copy and pasted from a tutorial - damn copy and pasting) in my TableModel:
            public boolean isCellEditable(int row, int col) {
                //Note that the data/cell address is constant,
                //no matter where the cell appears onscreen.
                if (col < 3) {
                    return false;
                } else {
                    return true;
    }A pretty stupid thing when you want to edit the 3rd column...

  • JTable: Custom Table Model (pII)

    As was explained in pI, I'm creating a custom table model to overcome a few pitfalls I came across using the DefaultTableModel class, such as aligning cells, and getting certain columns to return only numeric type data. However, I've come upon a few roadblocks myself.
    How do I create each of the following methods:
    insertRow(int ow, int column)
    remove row(int row)
    addRow(Object[] rowData)Assuming that I decide to allow the user to add a column to the table, how would I create the methodaddColumn(Object columnName, Object[] columnData)And also, as I'm creating a custom table model, would I need to replicate DefaultTableModel's methods that inform the listeners that a change has been made to the table?
    Thanks!

    Thanks!
    I just got this response. Anyways, I found another solution that was, interestingly, from one of your threads written in 2005.
    This is what I did:
    // Letting the JTable know what each column stores and should return by
       // overloading the getColumnClass() method
       public Class getColumnClass(int column)
            if(recordsTable.getColumnName(column) == "Ranking")
              return Integer.class;
         /* Why do I keep ketting an IllegalArgumentException here? *
           * It keeps saying it cannot format given object as a Number */            
            else if(recordsTable.getColumnName(column) == "Price (�) ")
              return Float.class;
         else
           return getValueAt(0, column).getClass();         
       }However, another problem has arisen.
    The if method for the int column (Ranking column) works okay, and is even right-aligned. The else if arguments for the Price (�) column however is returning an IllegalArgumentException. This I just cannot figure out.
    Here's the code:package Practice;
      import java.awt.BorderLayout;
      import java.awt.Frame;
      import java.awt.Menu;
      import java.awt.MenuBar;
      import java.awt.MenuItem;
      import java.awt.MenuShortcut;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import java.awt.event.KeyEvent; // for MenuItem shortcuts
      import java.awt.event.WindowAdapter;
      import java.awt.event.WindowEvent;
      import java.awt.event.WindowListener;
      import javax.swing.JOptionPane;
      import javax.swing.JScrollPane; // JTable added to it, aiding flexibility
      import javax.swing.JTable; // The personally preferred GUI for this purpose
            // Provides a basic implementation of TableModel
      import javax.swing.table.DefaultTableModel;
              // This class uses Vector to store the rows and columns of data, though
              // programmer will be using LinkedLists
      import java.util.LinkedList;
      // User-defined classes
      import Practice.MusicDatabase;
      public class MusicBank extends Frame implements ActionListener
         MusicDatabase mDBase;
         Frame frame;
         String title = "",      // Frame's title
                file = "";           // pathname of the file to be opened
          // Declaring Menu and MenuItem variables
         Menu recordM; // ...
         // recordM
         MenuItem newRecordR_MI, deleteRecordR_MI;
         // Other irrelevant menus and sub items
        DefaultTableModel recordDetails;
        JTable recordsTable;
        LinkedList musicList;
        public MusicBank()
            musicList = new LinkedList();
            frame = new Frame(title);
            frame.setMenuBar(menuSystem());
            // Should user seek to close window externally
            frame.addWindowListener(new WindowAdapter()
                 public void windowClosing(WindowEvent we)
                     frame.dispose();
                     System.exit(0);
         recordDetails = new DefaultTableModel();
         // Creating the relevant columns
         recordDetails.addColumn("Title");
         recordDetails.addColumn("Identity");
         recordDetails.addColumn("Music Company");
         recordDetails.addColumn("Ranking");
         recordDetails.addColumn("Price (�) ");
         // Ensuring the table has at least one visible record (empty)
         recordDetails.addRow(populateRow("", "", "", 0, 0.00f));
         // Creating the table to display the data files (music record details)
         recordsTable = new JTable(recordDetails)
             // Letting the JTable know what each column stores and should return by
             // overloading the getColumnClass() method
            public Class getColumnClass(int column)
               if(recordsTable.getColumnName(column) == "Ranking")
                   return Integer.class;
                /* Why do I keep ketting an IllegalArgumentException here? *
                 * It keeps saying it cannot format given object as a Number */            
                else if(recordsTable.getColumnName(column) == "Price (�) ")
                    return Float.class;
                else
                    return getValueAt(0, column).getClass();         
      // Creating the menus
      public MenuBar menuSystem()
          MenuBar bar = new MenuBar();
          // Record menu and related items
          recordM = new Menu("Record");
          recordM.setShortcut(new MenuShortcut(KeyEvent.VK_R, false));        
          newRecordR_MI = new MenuItem("New record");
          newRecordR_MI.setShortcut(new MenuShortcut(KeyEvent.VK_N, false));
          deleteRecordR_MI = new MenuItem("Delete record");
          deleteRecordR_MI.setShortcut(new MenuShortcut(KeyEvent.VK_D, false));
           recordM.add(newRecordR_MI);
           recordM.addSeparator();
           recordM.add(deleteRecordR_MI);
            // Enabling menus with functionality
           newRecordR_MI.addActionListener(this);
           deleteRecordR_MI.addActionListener(this);
           // Adding menus and items to menu bar
           bar.add(recordM);
           return bar;        
      public void actionPerformed(ActionEvent ae)
          if(ae.getSource() == newRecordR_MI)
             newRecord();
          else if(ae.getSource() == deleteRecordR_MI)
             deleteRecord();       
      // Object that will be used, in conjunction with MusicDatabase's, to 
      // populate the JTable
      // A record in a JTable is equivalent to an element in a LinkedList
      public Object[] populateRow(String title, String name, String comp, int rank, float price)
          // First, update the LinkedList
          mDBase = new MusicDatabase(title, name, comp, rank, price);
          musicList.add(mDBase);
           // Then, update the table
           // As the parameters of Object tableDetails can only take a String or
           // object, rank and price will have to be cast as a String and later
           // parsed to their original form before use.
           String rankPT = ""+rank, pricePT = ""+price;        
           Object rowDetails[] = {title, name, comp, rankPT, pricePT};
           return rowDetails;
      public static void main(String args[])
          MusicBank app = new MusicBank();
           // Using the platform's L&F (if Win32,  Windows L&F; Mac OS, Mac OS L&F,
           // Sun, CDE/Motif L&F)
           // For more on this, refer to the WinHelp Java tutorial by F. Allimont
           try
               UIManager.getSystemLookAndFeelClassName();
           catch(Exception e)
               JOptionPane.showMessageDialog(app,
                    "Failed to create the Windows Look and Feel for this program",
                    "Look and Feel (L&F) error",
                    JOptionPane.ERROR_MESSAGE);
           app.frame.setSize(500, 500);
           app.frame.setVisible(true);
            // Placing frame in the centre of the screen on-loading
           app.frame.setLocationRelativeTo(null);
      // action methods per menu items
      // Also, why do I keep getting an ArrayIndexOutOfBoundsException
      // here? I do know what this exception is, and how it works, but just cannot
      // understand what is causing it
      public void newRecord()
          // Before adding a new record, check if previous record has complete
          // entries. If not, either display a message (JOptionPane) or disallow
          // request (simply do nothing)        
          // Proceed based on assesment
          if(queryState() == true)
              // Inform user that all entries need to be filled in before a new
              // record can be created
              JOptionPane.showMessageDialog(this, // current frame
                       "There are incomplete cells in the table."+
                       "\nPlease fill these in before proceeding",       // Message to user
                       "Incomplete entries",                                // Title
                       JOptionPane.ERROR_MESSAGE);                           // Relevant icon
          else
               // To ensure that both the linked list & the table are simultaneously
               // updated, JOptionPane's input dialogs are used to temporarily store
               // the data which is then inputted into both (linked list and JTable)
              String titleN, identityN, companyN; int rankN; float priceN;
              titleN = JOptionPane.showInputDialog(this, "Enter song title");
              identityN = JOptionPane.showInputDialog(this,                                      "Enter name of singer/band");
             companyN = JOptionPane.showInputDialog(this,                                 "Enter signed/unsigned company");
             rankN = Integer.parseInt( JOptionPane.showInputDialog(this,
                             "Enter rank (a number)") );
            System.out.println("\n JTable rows = "+recordDetails.getRowCount());
             // Ensuring that the chosen rank is not already entered
             /* Problem lies here */
             for(int row = 1; row <= recordDetails.getRowCount(); ++row)
                 if((recordDetails.getValueAt(row, 4)).equals(""+rankN))
                     rankN = Integer.parseInt( JOptionPane.showInputDialog(this,
                             "That number's already chosen.\nPlease enter a rank ") );
             priceN = Float.parseFloat( JOptionPane.showInputDialog(this,                                 "Finally, enter price �") );
             mDBase = new MusicDatabase(titleN, identityN, companyN, rankN, priceN);
             musicList.add(mDBase);
             recordDetails.addRow(populateRow(titleN, identityN, companyN, rankN,
         priceN));
             System.out.println("JTable rows after creation = "+
                   recordDetails.getRowCount());
         // Enabling the delete record menu item (as necessary)
         if((recordsTable.getRowCount()) > 0)
              deleteRecordR_MI.setEnabled(true);
      } // newRecord()
      public void deleteRecord()
         int selectedRow = recordsTable.getSelectedRow();
         recordDetails.removeRow(selectedRow);
          // Removing the element from the LinkedList's corresponding index
          musicList.remove(selectedRow);
          System.out.println("Existing rows = "+recordsTable.getRowCount());
           // If there are no more rows, disallow user from trying to delete rows
           if(selectedRow <= 0)
              deleteRecordR_MI.setEnabled(false);
      } // deleteRecord()
      // Method to query if all cells have changed their states (empty or not)
      public boolean queryState()
          // Obtaining number of rows
          int rows = recordDetails.getRowCount();
          int columns = recordDetails.getColumnCount();
          boolean isEmpty = false; // cell
          System.out.println("Rows = "+rows);
          System.out.println("Columns = "+columns);
          try{
              // Assessing all cells for complete entries
              // This approach is flexible, rather than hardcoding the rows available,
              // making it more reusable (assuming it will always be 5 columns)
              for (int rowIndex = 0; rowIndex<=rows; ++rowIndex)
                  if((recordDetails.getValueAt(rowIndex, 1)).equals(""))
                 isEmpty = true;
                  else if((recordDetails.getValueAt(rowIndex, 2)).equals(""))
               isEmpty = true;
                  else if((recordDetails.getValueAt(rowIndex, 3)).equals(""))
               isEmpty = true;                
                  else if((recordDetails.getValueAt(rowIndex, 4)).equals("0"))
               isEmpty = true;
                  else if((recordDetails.getValueAt(rowIndex, 5)).equals("0.00"))
               isEmpty = true;
          catch(Exception e)
             System.out.println(e.getMessage());
          return isEmpty;
      Now here is the code for the MusicDatabase class
    package Practice;
    class MusicDatabase
        private String songTitle, identity, musicCompany;
        private int rank;
        private float priceF;
        // Defining the constructor
        public MusicDatabase(String title, String name, String company,                                int rankingInt, float price)
           songTitle = title;
           identity = name;
           musicCompany = company;
           rank = rankingInt;
           priceF = price;
        } // constructor
       // Other methods
    } // class MusicDatabaseSorry, but am not sure if these codes are executable, as where I am (a general library), JVM is not on the machine I am using. (Remember, i don't have ready acess to the Internet, so I could not use my machine, nor the facilities that had the JVM - unavailable to me at the time).
    Thanks!
    Reformer...
    PS I do hope the code pasted was not too much. Kind regards....

  • [nQSError: 59014] The  requested column does not exist in this table.

    Hi
    As you know this error has been discussed in other threads.. the difference in mine is that not only the time series measures but all the columns are giving me the error...none of the columns are being displayed... The rpd has no consistency errors. can anyone suggest what may be going on?
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 59014] The requested column does not exist in this table. (HY000)
    SQL Issued: SELECT column1 saw_0 FROM Paint3 ORDER BY saw_0
    Thank you
    mm58

    I guess you have the column in RPD, and it is available for queries.
    are you using any time measures? if so check you chronological keys.

  • JTable: Custom Table Model (pI)

    This is a follow-up to thread http://forum.java.sun.com/thread.jspa?threadID=725162 and thread http://forum.java.sun.com/thread.jspa?threadID=725158.
    As I'm hoping to have a table of 5 columns, where the 4th and 5th columns are for integer and float data types respectively, I am creating a custom table model under the assumption that I will not know beforehand the number of rows the table will contain.
    Problems? Having not specified the cell contents of the table, since it will be pupulated by users unknown to me, I did not declare or initialize a variable similar to TableDemo's data variable of type Object (see the TableDemo tutorial http://java.sun.com/docs/books/tutorial/uiswing/components/example-swing/TableDemo.java). As such, I am unable to specify the return parameters for the getRowCount() and getValueAt(~, ~) methods.
    To overcome this, I sought to replicate the example shown in TableDemo by doing the following:
    Object[][] cell = {"", "", "", new Integer(0), new Float(0.00f)};
    public int getRowCount()
      returncell.length;
    public Object getValueAt(int row, int column)
      return cell[row][column];
    //...I got the following errors:
    pathname\CustomTableModel.java:line #: incompatible types
    found: java.lang.String
    required: java.lang.Object[]
    and the errors continue...
    So I tried
    Object[] cell = {"", "", "", new Integer(0), new Float(0.00f)};
    // ...However, I got this error:
    C:\...\CustomTableModel.java:line #:array required, but java.lang.String found
    return cell[row][column];
    .......................... ^
    I just want to set the return parameters for getRowCount() and getValueAt(~,~) in the custom table model I'm creating. How do I do this?
    Cheers!
    PS Thanks for reading this far...

    I decided to use the DefaultTableModel, after all. I was using it before, but at the time, i didn't know that certain things I wanted to accomplish, it could too.
    Anyways, here's what I have been doing: http://forum.java.sun.com/thread.jspa?threadID=725861
    Thanks nonetheless for your help. And by the way, my client is adamant that I use a LinkedList, rather than a Vector for this project. But nevertheless, thanks.

  • The requested column does not exist in this table

    Hi All,
    I am getting the following error:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 59014] The requested column does not exist in this table. (HY000)
    SQL Issued: SELECT "Customers - Dim".CITY FROM MVDEMO ORDER BY 1
    When I tried viewing data online I am able to view the data in the physical Layer. Also I tried connecting thru ODBC Client and issued the same SQL (above) and it returns the data.
    I am using Oralce BIEE 10.1.3.2.1 version.
    Please let me know if any faced this kinda issue and how to resolve this.
    Thank you.

    Check your column mapping in the BMM layer in your Customers - Dim logical table. Does the CITY column point to a physical table column?

  • I have problem sending a email ..spool not created using custom FM

    Hi experts,
    i have problem sending a email ..spool not created using custom FM...this the custom FM
    * Send email notification
          lv_subject = text-037.
          lv_attachment = text-038.
          CALL FUNCTION 'Z_SEND_EMAIL_FROM_SPOOL'
            EXPORTING
              email1            = lv_email1
              email2            = lv_email2
              email3            = lv_email3
              subject           = lv_subject
              attachment_name   = lv_attachment
            EXCEPTIONS
              spool_not_created = 1
              OTHERS            = 2.
    Source code
    this is the source code for this FM
    IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
        PERFORM convert_spool_to_pdf.
        IF sy-subrc IS NOT INITIAL.
          MESSAGE e040(zhrcd) RAISING spool_not_created.
        ENDIF.
        PERFORM process_email USING email1
                                    email2
                                    email3
                                    subject
                                    attachment_name.
        WAIT UP TO 5 SECONDS.
        SUBMIT rsconn01 WITH mode   = 'INT'
                        WITH output = 'X'
                        AND RETURN.
      ENDIF.....
    Please let me know
    Edited by: Thomas Zloch on Nov 16, 2010 5:53 PM - please use code tags

    Hi srinivas ,
    Could you please Check
    FORM summary_report .
      DATA: lv_success TYPE i,
              lv_error TYPE i,
              lv_total TYPE i.
      DESCRIBE TABLE gt_data LINES lv_success.
    DESCRIBE TABLE gt_error LINES lv_error.
      DESCRIBE TABLE gt_message LINES lv_error.
    lv_total = lv_success + lv_error.
      lv_total = lv_success.
      gwa_summary-record = text-008."Number of Successful records.
      gwa_summary-number = lv_success.
      APPEND gwa_summary TO gt_summary.
      gwa_summary-record = text-009."Number of error records'.
      gwa_summary-number = lv_error.
      APPEND gwa_summary TO gt_summary.
      gwa_summary-record = text-010."Total number of records processed.
      gwa_summary-number =  lv_total.
      APPEND gwa_summary TO gt_summary.
    CLEAR gt_fieldcat.
      gwa_fieldcat_summ-col_pos = 1 .
      gwa_fieldcat_summ-fieldname  = 'RECORD'.
      gwa_fieldcat_summ-tabname = 'GT_SUMMARY'.
      gwa_fieldcat_summ-seltext_l  = text-011."Records
      gwa_fieldcat_summ-outputlen = '70'.
      APPEND gwa_fieldcat_summ TO gt_fieldcat_summ.
      gwa_fieldcat_summ-col_pos = 2 .
      gwa_fieldcat_summ-fieldname  = 'NUMBER'.
      gwa_fieldcat_summ-tabname = 'GT_SUMMARY'.
      gwa_fieldcat_summ-seltext_l  = text-012."Number
      gwa_fieldcat_summ-outputlen = '10'.
      APPEND gwa_fieldcat_summ TO gt_fieldcat_summ.
    ENDFORM.                    " SUMMARY_REPORT
    *&      Form  ERROR_REPORT
    FORM error_report .
    gt_fieldcat_err[] = gt_fieldcat[].
      gv_fieldcat_err-col_pos = 1.
      gv_fieldcat_err-fieldname  = 'PERNR'.
      gv_fieldcat_err-tabname = 'GT_MESSAGE'.
      gv_fieldcat_err-seltext_l  = text-070."Employee Number
      gv_fieldcat_err-outputlen = '20'.
      APPEND gv_fieldcat_err TO gt_fieldcat_err.
      gv_fieldcat_err-col_pos = 2.
      gv_fieldcat_err-fieldname  = 'MESSAGE'.
      gv_fieldcat_err-tabname = 'GT_MESSAGE'.
      gv_fieldcat_err-seltext_l  = text-071."Error Message
      gv_fieldcat_err-outputlen = '80'.
      APPEND gv_fieldcat_err TO gt_fieldcat_err.
    ENDFORM.                    " ERROR_REPORT
    *&      Form  FINAL_REPORT
    FORM final_report .
      DATA:lv_layout TYPE slis_layout_alv,
             lt_events_summ TYPE slis_t_event,
             lv_events_summ LIKE LINE OF lt_events_summ,
             lt_events_det TYPE slis_t_event,
             lv_events_det LIKE LINE OF lt_events_det,
             lt_events_err TYPE slis_t_event,
             lv_events_err LIKE LINE OF lt_events_det,
             lt_events_msg TYPE slis_t_event,
             lv_events_msg LIKE LINE OF lt_events_det.
      lv_events_summ-name = 'TOP_OF_PAGE'.
      lv_events_summ-form = 'TOP_OF_PAGE1'.
      APPEND lv_events_summ TO lt_events_summ.
      lv_events_det-name = 'TOP_OF_PAGE'.
      lv_events_det-form = 'TOP_OF_PAGE2'.
      APPEND lv_events_det TO lt_events_det.
      lv_events_err-name = 'TOP_OF_PAGE'.
      lv_events_err-form = 'TOP_OF_PAGE3'.
      APPEND lv_events_err TO lt_events_err.
      lv_events_msg-name = 'TOP_OF_PAGE'.
      lv_events_msg-form = 'TOP_OF_PAGE4'.
      APPEND lv_events_msg TO lt_events_msg.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
        EXPORTING
          i_callback_program = sy-repid.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout                        = lv_layout
          it_fieldcat                      = gt_fieldcat_summ
          i_tabname                        = 'IT_SUMMARY'
          it_events                        = lt_events_summ
      IT_SORT                          =
      I_TEXT                           = ' '
        TABLES
          t_outtab                         = gt_summary
    EXCEPTIONS
      PROGRAM_ERROR                    = 1
      MAXIMUM_OF_APPENDS_REACHED       = 2
      OTHERS                           = 3
    IF CHK_DTL IS NOT INITIAL.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout                        = lv_layout
          it_fieldcat                      = gt_fieldcat
          i_tabname                        = 'gt_data'
          it_events                        = lt_events_det
      IT_SORT                          =
      I_TEXT                           = ' '
        TABLES
          t_outtab                         = gt_data
    EXCEPTIONS
      PROGRAM_ERROR                    = 1
      MAXIMUM_OF_APPENDS_REACHED       = 2
      OTHERS                           = 3
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
       EXPORTING
         is_layout   = lv_layout
         it_fieldcat = gt_fieldcat_err
         i_tabname   = 'gt_error'
         it_events   = lt_events_err
       TABLES
         t_outtab    = gt_error.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
       EXPORTING
         is_layout   = lv_layout
         it_fieldcat = gt_fieldcat_msg
         i_tabname   = 'gt_message'
         it_events   = lt_events_msg
       TABLES
         t_outtab    = gt_error.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout   = lv_layout
          it_fieldcat = gt_fieldcat_err
          i_tabname   = 'gt_message'
          it_events   = lt_events_err
        TABLES
          t_outtab    = gt_message.
    IF GT_MESSAGE[] IS NOT INITIAL.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout   = lv_layout
          it_fieldcat = gt_fieldcat_msg
          i_tabname   = 'gt_message'
          it_events   = lt_events_msg
        TABLES
          t_outtab    = gt_message.
    ENDIF.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
    EXPORTING
       i_interface_check             = ' '
      IS_PRINT                      =
       i_screen_start_column         = 0
       i_screen_start_line           = 0
       i_screen_end_column           = 0
       i_screen_end_line             = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER       =
      ES_EXIT_CAUSED_BY_USER        =
    EXCEPTIONS
      PROGRAM_ERROR                 = 1
      OTHERS                        = 2
    ENDFORM.                    " FINAL_REPORT
    *&      Form  top_of_page
          text
    FORM top_of_page1.                                          "#EC CALLED
      WRITE text-013."SUMMARY REPORT.
    ENDFORM.                    "top_of_page
    *&      Form  top_of_page2
          text
    FORM top_of_page2.                                          "#EC CALLED
      WRITE text-014."DETAIL REPORT.
    ENDFORM.                    "top_of_page
    *&      Form  top_of_page3
          text
    FORM top_of_page3.                                          "#EC CALLED
      WRITE text-015."ERROR REPORT
    ENDFORM.                    "top_of_page
    *&      Form  EMAIL_NOTIFICATION
    FORM email_notification .
      DATA: lv_email1  TYPE somlreci1-receiver,
           lv_email2  TYPE somlreci1-receiver,
           lv_email3  TYPE somlreci1-receiver,
           lv_subject TYPE char200,
           c_flag     TYPE c           VALUE 'X',
           lv_attachment TYPE char50.
      CLEAR: lv_email1,
             lv_email2,
             lv_email3,
             lv_subject,
             lv_attachment.
      SELECT SINGLE email1
                    email2
                    email3
        FROM zhr_interface_pr
        INTO (lv_email1,lv_email2,lv_email3)
        WHERE zinterfaceid EQ gc_objectid.
      IF sy-subrc EQ 0.
        IF sy-batch EQ 'X'.
    Send email notification
          lv_subject = text-037.
          lv_attachment = text-038.
          CALL FUNCTION 'Z_SEND_EMAIL_FROM_SPOOL'
            EXPORTING
              email1            = lv_email1
              email2            = lv_email2
              email3            = lv_email3
              subject           = lv_subject
              attachment_name   = lv_attachment
            EXCEPTIONS
              spool_not_created = 1
              OTHERS            = 2.
          IF sy-subrc <> 0.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.                    "
    Edited by: katewinslate@SAP on Nov 17, 2010 12:50 PM

  • Image content type in Site Asset Image library: The Preview and Thumbnail Preview columns do not display the picture of the item.

    I have two different Site Asset libraries.  The Site Asset Picture library has items of
    content type picture.  The Site Asset Image Library has items of
    content type image. 
    1) I do not quite understand the different between a picture content type versus an image content type. 
    2) the thumbnail and preview columns do not display the image in the Site Asset
    Image Library.  (the image does display in the thumbnail column of the Site Asset Picture library.)  I expected the image to display in the Site Asset Image Library the same as it does in the Site Asset Picture library. 
    Why doesn't it?
    Betty
    Betty Stolwyk

    I have subsequently found out that our "Site Asset Images" library is a Document Library to which someone must have replaced the Document content type with an Image content type.  I also found out that picture previews/thumbnails cannot be displayed
    in Document libraries.  So the problem was the library type, not the content type.
    So I simply created a new Picture Library (whose content type = picture) and copied the files into that and the thumbnails displayed just fine!
    I bet what led to this is the default "Site Assets" library that is created for a new Team site.  It is just a document library but sounds very similar to the "Assets" library.  I can imagine someone thinking the "Site Assets" library was a standard
    container for images, and simply changed the name to better identify the content! 
    As far as 'image' vs 'picture' content types, I noticed that a new Picture Library contains a content type of 'picture', but an Asset Library contains a content type of 'image' (as well as audio and video).  Although the 'image' content type has a few
    more fields than the 'picture' content type (picture content type does not have thumbnail), the actual Picture Library contains pretty much all the same fields, including the thumbnail.  So for all practical purposes, either library type can be used for
    storage of pictures.  I am guessing that the Pictures Library which uses the picture content type is for backwards compatibility purposes, and that the 'image' content type is newer, being derived from the new "Rich Media Asset" content type and used
    in the new Asset Library which can hold audio and video in addition to pictures.  
    Microsoft Help also mentioned that a Picture Library has a slide view which an Asset library does not.  So my take on that is that if you want the potential of seeing your pictures as a slide show, put them in a Picture library which is still using
    the 'picture' content type of previous SharePoint versions.  If you want to keep pictures organized with audio/video files, then put them into an Asset library which uses the  'image' content type derived from the new Rich Media Asset content type.
    Betty Stolwyk

Maybe you are looking for