JTable Column not included in sorting

I dont want to include column 0 in the sorting, using TableSorter. That is when a sorting command is activated by clicking the table header, column 0 data would not be sorted but remain fixed.
I have searched previous posts and tried various means for days now without a solution.
even the underlisted, which i tried last did not work
table.getColumnModel().getColumn(0).setCellRenderer (table.getTableHeader().getDefaultRenderer() );
table.getTableHeader().setReorderingAllowed(false);
Pls help

Use camickr's trick:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=601267
or, write your custom sorter.
Implementing a custom table row sorter is much simpler than using existing TableSorter class.

Similar Messages

  • Ot? making jtable column not enabled?

    I've a jtable with an abstract table model. I can set up the isCellEditable (via the table model) to return false for a given column, but the user can still "tab" into that column or select it.
    Can someone indicate how to set the column as being not "Enabled" so that tab will skip over that column, and the user may not select it?
    TIA

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by kkirk:
    I've a jtable with an abstract table model. I can set up the isCellEditable (via the table model) to return false for a given column, but the user can still "tab" into that column or select it.
    Can someone indicate how to set the column as being not "Enabled" so that tab will skip over that column, and the user may not select it?
    TIA<HR></BLOCKQUOTE>
    Hi,
    Yesterday, when working with a TextFieldControl, I stumbled upon "setRequestFocusEnabled(boolean b)". I you set this to false for the textfieldcontrol, it is skipped when tabbing and you can't get your cursor in it.The method is defined in JComponent.
    Maybe this works with the table?
    I hope this helps
    Lonneke
    null

  • 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.

  • Sort Order Column not Working

    I have set a sort order column on one of A VARCHAR field, but the functionality is not working. The sorting is enabled in the table view and when I sort by the said column it still sorts based on the VARCHAR values of the column instead of the other INT column I want to sort by. The logical SQL and physical query never even includes the column to sort. Are there any exceptions for the 'Sort Order Column' setting? Is there a config setting or data connections setting that I need to check to make this work?
    Thank You!
    Edited by: VNC on Oct 3, 2011 9:08 AM

    hi,
    can you give me more detailes like some sample column data like below kind
    Like Ex: varchar month column it sould display based on month id
    month : Fev-2011,Dec-2011,jan-2011 and month id 1 to 12
    set your month id as sort order column of month name.
    double click month name ->In general tab set the sort order column as month id
    FYI...see the sample link
    http://www.biconsultinggroup.com/obiee-tips-and-tricks/setting-a-sort-order-column.html
    i hope helped you
    THanks
    Deva
    Edited by: Devarasu on Oct 4, 2011 12:39 AM

  • F2 key not working with custom JTable Column

    I have a custom JTable Column (which is a JPanel with a JTextfield and JButton). Everything works as expected, except when the user presses "F2" to start editing the custom column cell. When the user presses F2, the custom cell goes into editing mode, but I am unable to type anything in it.
    Below is the SSCCE.
    Steps to Reproduce problem:
    1) Run the Program
    2) Select any cell in first Column.
    3) Press "F2" and try to type into the cell. Can't type anything.
    package com.ns;
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.Point;
    import java.awt.Toolkit;
    import java.awt.event.ActionEvent;
    import java.awt.event.KeyEvent;
    import java.util.EventObject;
    import javax.swing.DefaultCellEditor;
    import javax.swing.JButton;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextField;
    import javax.swing.SwingUtilities;
    import javax.swing.UIManager;
    import javax.swing.WindowConstants;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellRenderer;
    public class TextButtonCellFrame extends javax.swing.JFrame {
        // Variables declaration - do not modify                    
        private JTextField inputText;
        private JScrollPane jScrollPane1;
        private JPanel testPanel;
        private JTable testTable;
        // End of variables declaration                  
        public TextButtonCellFrame() {
            initComponents();
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                         
        private void initComponents() {
            testPanel = new JPanel();
            jScrollPane1 = new JScrollPane();
            testTable = new JTable();
            inputText = new JTextField();
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            testTable.setModel(new DefaultTableModel(
                new Object [][] {
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null}
                new String [] {
                    "Title 1", "Title 2", "Title 3", "Title 4"
            testTable.setCellSelectionEnabled(true);
            testTable.setRowHeight(52);
            testTable.setSurrendersFocusOnKeystroke(true);
            testTable.getColumnModel().getColumn(0).setCellRenderer(new MyTableCellRenderer());
            testTable.getColumnModel().getColumn(0).setCellEditor(new MyTableCellEditor(new JTextField()));
            testTable.getColumnModel().getColumn(0).setPreferredWidth(200);
            jScrollPane1.setViewportView(testTable);
            testPanel.add(jScrollPane1);
            inputText.setPreferredSize(new Dimension(50, 20));
            testPanel.add(inputText);
            getContentPane().add(testPanel, BorderLayout.CENTER);
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            setBounds((screenSize.width-576)/2, (screenSize.height-417)/2, 576, 417);
        }// </editor-fold>                       
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new TextButtonCellFrame().setVisible(true);
        public class MyTableCellRenderer extends JPanel implements TableCellRenderer {
            Point point;
            JButton button1 = new JButton("Test 1");
            JTextField txtField = new JTextField();
            public MyTableCellRenderer() {
                setLayout(new BorderLayout());
                this.add(button1, BorderLayout.EAST);
                this.add(txtField,BorderLayout.CENTER);
            public Component getTableCellRendererComponent(JTable table, Object value,
                    boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) {
                if (isSelected) {
                    txtField.setBackground(testTable.getSelectionBackground());
                    txtField.setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
                else {
                    txtField.setBackground(testTable.getBackground());
                    txtField.setBorder(null);
                return this;
        public class MyTableCellEditor extends DefaultCellEditor {
            JPanel panel = new JPanel();
            JButton button1 = new JButton ("Test 1");
            JTextField txtField;
            MyTableCellEditor(JTextField txtField) {
                super (txtField);
                this.txtField = txtField;
                panel.setLayout(new BorderLayout());
                panel.add(button1, BorderLayout.EAST);
                panel.add(txtField,BorderLayout.CENTER);
            public void actionPerformed(ActionEvent e) {
                if (e.getSource() == button1)
                    JOptionPane.showMessageDialog(null, "Action One Successful");
            public Component getTableCellEditorComponent(JTable table, Object value,
                                        boolean isSelected, int row, int column) {
                return panel;
           public boolean isCellEditable(final EventObject anEvent) {
              if (anEvent instanceof KeyEvent) {
                 final KeyEvent keyEvent = (KeyEvent) anEvent;
                 SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                       if (!Character.isIdentifierIgnorable(keyEvent.getKeyChar())) {
                          txtField.setText(txtField.getText() + keyEvent.getKeyChar());
                       txtField.setCaretPosition(txtField.getText().length());
                       txtField.requestFocusInWindow();
                return super.isCellEditable(anEvent);
    }The code for isCellEditable(final EventObject anEvent) which is needed to edit the cell using keyboard was provided by DarrylBurke here
    regards,
    nirvan.

    The F2 key when pressed generates an action event (either JTable generates it or some other component). I am not sure how to handle the action event in the isCellEditable() method. Also, F(X) range of keys other than F2 dump some junk character in the JTextfield when pressed. I am now stuck at this point and don't know how handle F(X) range of keys.
    regards,
    nirvan.

  • Does not do the sorting if I click twice to the same column.

    Hello
    I am new to winforms.
    I have a listview. I want it to toggle the sorting of the records of the listview when the columns are clicked
    Please guide me as to how to do the same.
    The code that I have attached does not do the sorting if I click twice to the same column. I have to click a different column ten the previous column 
    The code is attached below
    regards
    Manoj Gokhale
    private void SiteInChargeorSupervisor_Load(object sender, EventArgs e)
    this.listView1.ColumnClick += new ColumnClickEventHandler(listView1_ColumnClick);
    private void listView1_ColumnClick(object sender, ColumnClickEventArgs e)
    ListViewSorter Sorter = new ListViewSorter();
    listView1.ListViewItemSorter = Sorter;
    if (!(listView1.ListViewItemSorter is ListViewSorter))
    return;
    Sorter = (ListViewSorter)listView1.ListViewItemSorter;
    if (Sorter.LastSort == e.Column)
    if (listView1.Sorting == System.Windows.Forms.SortOrder.Ascending)
    listView1.Sorting = System.Windows.Forms.SortOrder.Descending;
    else
    listView1.Sorting = System.Windows.Forms.SortOrder.Ascending;
    else
    listView1.Sorting = System.Windows.Forms.SortOrder.Descending;
    Sorter.ByColumn = e.Column;
    listView1.Sort();
    public class ListViewSorter : System.Collections.IComparer
    public int Compare(object o1, object o2)
    if (!(o1 is ListViewItem))
    return (0);
    if (!(o2 is ListViewItem))
    return (0);
    ListViewItem lvi1 = (ListViewItem)o2;
    string str1 = lvi1.SubItems[ByColumn].Text;
    ListViewItem lvi2 = (ListViewItem)o1;
    string str2 = lvi2.SubItems[ByColumn].Text;
    int result;
    if (lvi1.ListView.Sorting == System.Windows.Forms.SortOrder.Ascending)
    result = String.Compare(str1, str2);
    else
    result = String.Compare(str2, str1);
    LastSort = ByColumn;
    return (result);
    public int ByColumn
    get { return Column; }
    set { Column = value; }
    int Column = 0;
    public int LastSort
    get { return LastColumn; }
    set { LastColumn = value; }
    int LastColumn = 0;

    Every time through the ColumnClick event handler, you are creating a new sorter. This means that any values set in the sorter from the previous click are not saved.
    Try this.
    private void listView1_ColumnClick(object sender, ColumnClickEventArgs e)
    // Only create a new sorter if we don't have one already.
    if(listView1.ListViewItemSorter == null)
    ListViewSorter Sorter = new ListViewSorter();
    listView1.ListViewItemSorter = Sorter;
    // And so on with the rest of your code.

  • Columns not to be included in group by clause

    I have a select query where i need to display count of records group by state_name
    In my main select query i need to include two more columns which are not be included in group by clause so that the number of records displayed does not increase
    I need to pass all these values from front end application so that i get count of records only by statename
    But when i include these two columns in my select query my query is throwing an error bcoz i have not included them in my group by
    How can we prevent this by not adding it to group by clause

    One general approach is (using the emp dept example)
    I want
    deptno dname, count(distinct empno)
    I can do that
    select d.deptno, d.dname, count(distinct e.empno)
    from dept d, emp e
    where e.deptno=d.deptno
    group by d.deptno, d.dname;
    or
    select d.deptno, d.dname, count_emp
    from dept d,
    (select e.deptno, count(distinct empno)
    from emp e
    group by e.deptno
    where d.deptno = e.deptno
    or depending on version (you don't mention versionk, though most questions have version dependent answers)
    select deptno
    , dname
    , (select count(distinct empno) from emp e where e.deptno=d.deptno)
    from dept d
    Obviously you can also use the FIRST and the LAST function to avoid having to include a column in the GROUP BY clause.
    Sybrand Bakker
    Senior Oracle DBA

  • Do not allow to sort some columns in Alv Grid

    Dear friends,
    Please help me.
    I want to tell to the method set_table_for_first_display - make one of the columns not sortable.  Let's say the column name is "My Icon".
    What I mean with that is:
    when User will highlight column "My icon" and then click on sort buttons in the toolbar - no sort will happen on this column.
    I was trying to identify a field in lvc_s_sort which would say "do not sort this column".  Is there any?
    Or the only way to accomplish my task is to make sort buttons in the toolbar disable if column "My Icon" is clicked?
    gt_sort      TYPE lvc_t_sort.
        CALL  METHOD grid1->set_table_for_first_display
             EXPORTING i_structure_name = 'IT'
                       is_layout        = gs_layout
                       is_print         = gs_print
             CHANGING  it_outtab        = it
                       it_fieldcatalog  = gt_fcat
                       it_sort = gt_sort
    Thank you,
    Tatyana.

    Got a solution for ya, but you have to handle it thru coding.   So you will need to handle an event from your ALV grid. 
    First thing is that you need a local class as your event handler,  copy and paste this code.  Here we are using the name ALV_GRID for your alv object
    data: alv_grid       type ref to cl_gui_alv_grid.
    *       CLASS lcl_event_receiver DEFINITION
    class lcl_event_receiver definition.
      public section.
        methods handle_user_command
          for event before_user_command of cl_gui_alv_grid
          importing e_ucomm.
      private section.
    endclass.
    *       CLASS lCL_EVENT_RECEIVER IMPLEMENTATION
    class lcl_event_receiver implementation.
      method handle_user_command.
        data: icols type lvc_t_col,
              xcols like line of icols.
    * Get the currently selected column
        call method alv_grid->get_selected_columns
           importing
             et_index_columns = icols.
        read table icols into xcols index 1.
    * If the selected column is not one that should be sorted
        check xcols-fieldname = 'MATNR'.    "<-- Whatever columns that you don't want to allow sorting on.
    * Now check the function code, if sort ascending or descending, then give message
        check e_ucomm = cl_gui_alv_grid=>mc_fc_sort_asc
          or  e_ucomm =  cl_gui_alv_grid=>mc_fc_sort_dsc.
        message i001(00) with 'Can not sort on this column'.
    * Now set the UCOMM as if the user didn't click anything.
        call method alv_grid->set_user_command( space ).
      endmethod.
    endclass.
    data: event_receiver type ref to lcl_event_receiver.
    Also, you will need to set the event hanlder after calling the SET_TABLE_FOR_FIRST_DISPLAY.
      call method alv_grid->set_table_for_first_display
          changing
               it_outtab       = i_alv[]
               it_fieldcatalog = ifc[].
    *  Set the handler for ALV grid
      create object event_receiver.
      set handler event_receiver->handle_user_command for alv_grid.
    Just tested this, and works quite well.
    Regards,
    Rich Heilman

  • [Feature request] Runtime width of JTable columns based on attribute settings

    I'm wondering if it's possible to let 'JClient' dynamically resize the columns in a JTable. Eg: I have set the width of some attribute of some ViewObject to 3. But when I run the application all columns are equally sized. I tried changing the JTable's property autoResizeMode (figuring it might override settings by JClient), but that doesn't seem to have any effect.
    Also, 'grabbing' a column from the table through some manual coding and setting the width of that column doesn't seem to work either.
    I've posted something regarding JTable Re: for specifically RIZWAN from PAkistan or anyone, but I'm curious to know if this 'Specialised editor for Grid Control (JTable)' that Grant Ronald spoke of, will include some sort of applicable functionality.
    It's clear that we need some better (that is, 'any' ;)) way of manipulating columns in a JClient table.
    Any comments?
    Thanks.
    Arno

    We are currently looking into that.
    The column width should not be controlled from the model, it is a setting on JTable, We are considering providing a JClient control (JUTable ??), which is a JTable in a scrollpane and give you more power over column width, column headers etc....
    We are currently evaluating that.
    It would mean that you've got a table control with properties allowing you to set these things on the control itself.
    Currently you have to set the hints on the TableColumn.
    Here is an example :
    tableDeptView1.setModel(JUTableBinding.createAttributeListBinding(panelBinding, tableDeptView1, "DeptView1", null, "DeptView1Iter", new String[] {"Deptno", "Dname", "Loc"}));
    tableDeptView1.getColumn("Deptno").setMaxWidth(75);
    tableDeptView1.getColumn("Loc").setPreferredWidth(200);
    tableDeptView1.getColumn("Loc").setMinWidth(100);
    tableDeptView1.getColumn("Loc").setMaxWidth(450);

  • Exporting EPUB from InDesign CC not including line breaks

    I am done with a book and have it formatted the way I want. I am exporting it to EPUB through InDesign CC and previewing it in iBooks and also through Kindle previewer. Everything is fine except for one thing... where I have created page breaks, the exported file is not including them.
    I tried exporting to HTML just to see what it did and there is no line breaks there. I know its proprietary markup ( in kindle ) but I still would like to include them in a few specific places ( to mark seperations of chapters ).
    In kindle this is the tag they say to use: <mbp:pagebreak />
    In iBooks, I have not yet figured out how to create them, I am going to work on that today once I sort out the kindle version.
    Is there any way to force it to include line breaks on export. Or alternatively, I could export to HTML but I am having trouble figuring out how to go back to the EPUB format from there and also it didn't include the fonts, so there was other issues to consider as I have a custom font I was using for the headers that looks really good and matches the font on the book cover as well... so I really want to keep that consistent if possible.
    Are there any tricks or things I can try here to improve on my workflow and do a better job of seperating the chapters ?

    Ok, I hadn't tested the advanced options out in the export menu. It works and does so on both the iBooks and Kindle previewer.. which is good news since that is really important to me to try and find a workflow I can update both of these formats from when I continue to work on my book.
    The only strange part is that on some chapters its adding an extra blank page between the chapter and the next. What is odd is that it only happens on some of them (in the iBook reader only, the kindle previewer isn't doing this)
    I am going to look into this more closely but its not a major deal as I would prefer a little seperation in the chapters anyways, its not really a bad thing. It is just hard to figure out why its doing this.

  • Profit Center Report not include the Invoices entry

    Hi Expert,
    I want the report of my profit center which will show profit centre details including the dimension.
    I have run the following report but not fulfill the requirements
    1.The u201CProfit centre reportu201D in this report only u201CJEu201D is comes in report & Invoices post for the u201CProfit centre(Dimension1, Dimension2,Dimension3) u201Cis not included in that report.
    2.The u201CGeneral ledgeru201D report it will give the details of invoices but ,it is not showing the  Dim1,Dim2,Dim3 in the available column of report.
    Plese help me on this.Sap version 8.8 patch 15.

    Hi,
    You can create your own report by Crystal Report or query report.
    Thanks,
    Gordon

  • Custom list column not showing up in View Order by or Group by dropdown list

    Hi All,
    I have created a custom list with a custom column called "Description". Some items in the list do not have a description. What I wanted to do is create a view where the items with a description show first, and the items with no description are
    at the bottom of the list. I thought I could make a simple view that uses the Order by or Group by on the description column.
    The problem I am having is the description column doesn't show up in the dropdown list for either Order by or Group by within the custom view. Can someone please tell me why this happens and if there is anything I can do to rectify this problem.
    I hope you can help
    Colin

    Hi,
    I believe the "Description" field type is Multiple Lines of Text. Sorting doesn't allow in this field type. In order to do the sorting, you would require to create additional column like single line of text column (note that it supports only 255
    chars and require to truncate the data if more than 255) and update the data using event receiver or workflow. and do the sorting with that column.
    kmhsad

  • People Picker column not displaying name in list view

    I have a strange thing going on in list views. If I create a default view with a people picker column, it does not show the name - it appears to be blank (like below);
    If I then alter the view and make the style "Shaded" the user name appears (like below);
    It also seems to be an issue when looking at a Workflow process or survey results..  Can anybody explain to me why this is happening and how to resolve the issue? 

    Hi,
    As I understand, the issue occurs to All task view in task list, assigned to column not showing while it could be filtered.
    I’d recommend you create a new view with needed column including assigned to column, and make it default.
    Here is a similar thread, please check if it helps:
    http://sharepoint.stackexchange.com/questions/87089/assigned-to-column-text-hidden-but-filterable
    Regards,
    Rebecca Tu
    TechNet Community Support

  • How to catch selected text in JTable Column

    Hi there,
    I am learning JTable. Need help for How to get the selected text from the JTable Column which is set to be editable.
    for example in JTextFiled you have method on getSelectedText(), is there any method for tracking the selected text.
    Thanks in advance
    Minal

    Here's an example of the model I used in my JTable. Not the "getValueAt" method & "getRecordAt" method. You will have to have a Record object - but it only contains the attributes of an inserted record (with appropriate getters & setters). Hope this helps.
    public class FileModel5 extends AbstractTableModel
    public boolean isEditable = false;
    protected static int NUM_COLUMNS = 3;
    // initialize number of rows to start out with ...
    protected static int START_NUM_ROWS = 0;
    protected int nextEmptyRow = 0;
    protected int numRows = 0;
    static final public String file = "File";
    static final public String mailName = "Mail Id";
    static final public String postName = "Post Office Id";
    static final public String columnNames[] = {"File", "Mail Id", "Post Office Id"};
    // List of data
    protected Vector data = null;
    public FileModel5()
    data = new Vector();
    public boolean isCellEditable(int rowIndex, int columnIndex)
    // The 2nd & 3rd column or Value field is editable
    if(isEditable)
    if(columnIndex > 0)
    return true;
    return false;
    * JTable uses this method to determine the default renderer/
    * editor for each cell. If we didn't implement this method,
    * then the last column would contain text ("true"/"false"),
    * rather than a check box.
    public Class getColumnClass(int c)
    return getValueAt(0, c).getClass();
    * Retrieves number of columns
    public synchronized int getColumnCount()
    return NUM_COLUMNS;
    * Get a column name
    public String getColumnName(int col)
    return columnNames[col];
    * Retrieves number of records
    public synchronized int getRowCount()
    if (numRows < START_NUM_ROWS)
    return START_NUM_ROWS;
    else
    return numRows;
    * Returns cell information of a record at location row,column
    public synchronized Object getValueAt(int row, int column)
    try
    FileRecord5 p = (FileRecord5)data.elementAt(row);
    switch (column)
    case 0:
    return (String)p.file;
    case 1:
    return (String)p.mailName;
    case 2:
    return (String)p.postName;
    catch (Exception e)
    return "";
    public void setValueAt(Object aValue, int row, int column)
    FileRecord5 arow = (FileRecord5)data.elementAt(row);
    arow.setElementAt((String)aValue, column);
    fireTableCellUpdated(row, column);
    * Returns information of an entire record at location row
    public synchronized FileRecord5 getRecordAt(int row) throws Exception
    try
    return (FileRecord5)data.elementAt(row);
    catch (Exception e)
    throw new Exception("Record not found");
    * Used to add or update a record
    * @param tableRecord
    public synchronized void updateRecord(FileRecord5 tableRecord)
    String file = tableRecord.file;
    FileRecord5 p = null;
    int index = -1;
    boolean found = false;
    boolean addedRow = false;
    int i = 0;
    while (!found && (i < nextEmptyRow))
    p = (FileRecord5)data.elementAt(i);
    if (p.file.equals(file))
    found = true;
    index = i;
    } else
    i++;
    if (found)
    { //update
    data.setElementAt(tableRecord, index);
    else
    if (numRows <= nextEmptyRow)
    //add a row
    numRows++;
    addedRow = true;
    index = nextEmptyRow;
    data.addElement(tableRecord);
    //Notify listeners that the data changed.
    if (addedRow)
    nextEmptyRow++;
    fireTableRowsInserted(index, index);
    else
    fireTableRowsUpdated(index, index);
    * Used to delete a record
    public synchronized void deleteRecord(String file)
    FileRecord5 p = null;
    int index = -1;
    boolean found = false;
    int i = 0;
    while (!found && (i < nextEmptyRow))
    p = (FileRecord5)data.elementAt(i);
    if (p.file.equals(file))
    found = true;
    index = i;
    } else
    i++;
    if (found)
    data.removeElementAt(i);
    nextEmptyRow--;
    numRows--;
    fireTableRowsDeleted(START_NUM_ROWS, numRows);
    * Clears all records
    public synchronized void clear()
    int oldNumRows = numRows;
    numRows = START_NUM_ROWS;
    data.removeAllElements();
    nextEmptyRow = 0;
    if (oldNumRows > START_NUM_ROWS)
    fireTableRowsDeleted(START_NUM_ROWS, oldNumRows - 1);
    fireTableRowsUpdated(0, START_NUM_ROWS - 1);
    * Loads the values into the combo box within the table for mail id
    public void setUpMailColumn(JTable mapTable, ArrayList mailList)
    TableColumn col = mapTable.getColumnModel().getColumn(1);
    javax.swing.JComboBox comboMail = new javax.swing.JComboBox();
    int s = mailList.size();
    for(int i=0; i<s; i++)
    comboMail.addItem(mailList.get(i));
    col.setCellEditor(new DefaultCellEditor(comboMail));
    //Set up tool tips.
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setToolTipText("Click for mail Id list");
    col.setCellRenderer(renderer);
    //Set up tool tip for the mailName column header.
    TableCellRenderer headerRenderer = col.getHeaderRenderer();
    if (headerRenderer instanceof DefaultTableCellRenderer)
    ((DefaultTableCellRenderer)headerRenderer).setToolTipText(
    "Click the Mail Id to see a list of choices");
    * Loads the values into the combo box within the table for post office id
    public void setUpPostColumn(JTable mapTable, ArrayList postList)
    TableColumn col = mapTable.getColumnModel().getColumn(2);
    javax.swing.JComboBox combo = new javax.swing.JComboBox();
    int s = postList.size();
    for(int i=0; i<s; i++)
    combo.addItem(postList.get(i));
    col.setCellEditor(new DefaultCellEditor(combo));
    //Set up tool tips.
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setToolTipText("Click for post office Id list");
    col.setCellRenderer(renderer);
    //Set up tool tip for the mailName column header.
    TableCellRenderer headerRenderer = col.getHeaderRenderer();
    if (headerRenderer instanceof DefaultTableCellRenderer)
    ((DefaultTableCellRenderer)headerRenderer).setToolTipText(
    "Click the Post Office Id to see a list of choices");
    }

  • How to present a Column which includes multi lines

    Hi,
    In Oracle BI Publisher 11g, I'm trying to present a column which includes a long string with <CR>.
    Like an Example:
    abc
    def
    ghi
    But, It presents the all sting in one line like:
    abcdefghi
    How can I present it as its stored in the Database?
    Thanks.
    Edited by: Hadar on Feb 18, 2011 6:55 AM

    Thanks BipUser,
    This is not the same issue.
    I'm Talking about a column which includes multi lines.
    When I select it from SqlPlus:
    Select col1 From Tab1 Where rownum <2;
    I got:
    abc
    def
    ghi
    But, from Bi Publisher I got:
    abcdefghi
    Why? and how Can I Present it as it saved in Database?

Maybe you are looking for

  • 3D camera track points not displaying correctly

    Just bought a new iMac and am re-installing all of my programs including Creative Cloud programs. I am having an issue with After Effects not displaying all the track points when I use the 3D camera tracker. I get maybe 6-10 points displaying but tha

  • How to connect a 2nd screen

    I'm going to college soon and i wanted to get some extra workspace. I wanted to maybe use my screen on my macbook and connect it together with my lcd screen from my old pc so that my mouse would go from one screen to the other but work as a unit. Wha

  • Libiconv madness

    Gentleones, My nmblookup crashes every time something calls it, and it gripes with this message: Dyld Error Message: Symbol not found: iconvopen Referenced from: /usr/bin/nmblookup Expected in: /usr/local/lib/libiconv.2.dylib My smbd crashes like thi

  • Why am I suddenly getting the dreaded "ID =  5000" error with Illustrator 5.5? I'm only using CC for Muse.

    I only use Adobe Creative Cloud for Muse... no other option. I have CS 5.5 and am suddenly getting the "you do not have enough access privileges" error and can't save any illustrations. What the hell is going on with Adobe?

  • How to disactivate the lost mode after found?

    I put my iphone 4s to the lost mode via icloud.com, and after an hour i found my iphone. i entered my password, it didn't unlocked. in stead the screen went black. please help how to disactivate the lost mode via icloud.com since i cant enter the pas