JTable fixed columns, solution to multiple selection should sync to both

the solution is
private void checkSelectionMultiple(boolean isFixedTable) {
try {
int[] fixedRows = fixedTable.getSelectedRows();
int[] rows = tbl.getSelectedRows();
if(isFixedTable) {
isValueAdjusting = true;
tbl.clearSelection();
for (int i : fixedRows) {
tbl.addRowSelectionInterval(i, i);
isValueAdjusting = false;
} else {
isValueAdjusting = true;
fixedTable.clearSelection();
for (int i : rows) {
fixedTable.addRowSelectionInterval(i, i);
isValueAdjusting = false;
} catch(Exception e) {
System.out.println(e.getMessage());
}

Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.
I'm not sure if you are asking a question or making a statement.
If you want to synchronize the selection of two tables, then share the selection model:
fixed.setSelectionModel( main.getSelectionModel() );

Similar Messages

  • Multiple selection should enable the check box item next to the field

    Hi,
    I want multiple selection for " Environment" field in the Form. Once muliple values are selected, user needs to see a checkbox next to all the values selected in Environment field.
    Checkbox field should be called as ' Implemented'.
    For ex. In Environment Field, I selected three values, I should see checkbox against each selected environments:
    col 1:I Environment col:2 Implemented
    Env1 X
    Env2 X
    Env2 X
    X-> refers to checkbox.
    Please suggest something if anyone have tried this one.
    Thanks in advance.
    Regards,
    Ramya

    hello Ramya,
    In Environment Field, I selected three values, I should see checkbox against each selected environmentsyou can write Post-Change trigger or When-Validate-Item trigger on Column 1 say: txt_environment and in the trigger, write down the following code
              set_item_property('BLOCK.TXT_CHECKBOX',VISIBLE,PROPERTY_TRUE);
              set_item_property('BLOCK.TXT_CHECKBOX',ENABLED,PROPERTY_TRUE);
              set_item_property('BLOCK.TXT_CHECKBOX',NAVIGABLE,PROPERTY_TRUE);
    If someone's response is helpful or correct, please mark it accordingly.

  • Derived Column : for Lookup type column with 'Allow Multiple Selection' : True in sharepoint list

    Hello,
    I have one column where field type is Lookup but 'Allow Multiple Selection' is true in SharePoint List.
    So, in this scenario data from the SharePoint list is being exported as below.
    1;#Red;#3;#Blue;#4;#Black;#5;#Green
    Now resultant text exported to SQL Table should be :
    1,3,4,5
    OR
    Red,Blue,Black,Green
    Either way it is fine. How can we get this using Derived Column and Data Conversion?
    I am able to do this for single occurrence using below expression.
    (DT_STR,100,1252)(SUBSTRING([BusinessUnit],FINDSTRING([BusinessUnit],"#",1)+1,LEN([BusinessUnit])-FINDSTRING([BusinessUnit],"#",1)))
    Please suggest.
    Thank you,
    Mittal.

    Your best bet would be to do this in sql using a string parsing udf as below
    http://visakhm.blogspot.com/2010/02/parsing-delimited-string.html
    You can make it into procedure and call it from oledb command task.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Resizing columns and making multiple selections in Pages 5.0

    Using Pages 5.0 (using OS X), I am no longer able to resize columns in a table by dragging a selection handle as I could in the old Pages (2009, I think it was). Dragging now adds the adjacent column to the selection. Anyone know how to resize the columns by dragging?
    Also, in the previous Pages, I could select multiple noncontiguous words by holding down the command key. Doesn't work anymore. Does anyone know how to do that?

    Apple has removed 90+ features from Pages5:
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&mforum=iworktipsn trick
    Pages '09 should still be in your Applications/iWork folder:
    http://www.freeforum101.com/iworktipsntrick/viewtopic.php?t=432&mforum=iworktips ntrick
    Trash/Archive Pages 5 after exporting any Pages 5 files back to Pages '09 format.
    Then rate/review Pages 5 in the App Store.
    Peter

  • Disable text box on selecting a checkbox of multiple selection lookup field in infopath 2010

    Hi
    In edit mode of the form,
    We have added one field in infopath which is lookup column and shows multiple selection chekboxes.
    One of the option from that lookup checkbox list is "Other".
    There is one textbox field which will be disabled by default.
    We want to enable this text box on selection of "Other" from lookup field checkbox list.
    Is it possible?
    if yes how can we do this?

    Hi Vyanky, I don't believe that's possible without some major functionality. The problem, as you probably know, is that it's a lookup with checkboxes. If it was added directly in InfoPath, then it wouldn't be an issue. You should consider adding "Other"
    as a separate yes/no field instead. That way you'll be able to add an action rule to it to enable the text box.
    cameron rautmann

  • RAR5.3 not able to cut and paste list of users to Multiple Selection screen

    CC V4.0 on ABAP system has a feature where you can cut and paste a list of many users from the clipboard to Single Values column in the Multiple Selection screen, so you can run SOD Analysis Report for all those users.  The Multiply Selection screen is a standard SAP supplied pop up screen.
    With RAR 5.3 the Multiply Selection screen design is different.  There is no longer feature to cut and paste from clipboard.  We have to input each user one at a time.  So if you have many users (20, 30, etc.) it is a time consuming task.  It is not acceptable to our business power users.
    We can import the list of users to a Custom User Group (in the Configuration Tab).  First of all, there is no mass delete on Custom User Group.  You have to delete each user one at a time which is time consuming.  The alternative is to create a new Custom User Group each time, then it becomes a maintenance nightmare.  Secondly, it is in the Configuration Tab which is only available to Administrators (fear of users changing configuation data), so the Administrator (or whomever has access to the Configuration Tab) has to maintain the Custom User Groups which is a lot of work for him or her or them.
    We talk to SAP every week.  But they are looking at this as a long time project.  Does any one of you (or your company) has the same requirements?  How do you get around it?  Did you setup some other procedures so users can cut and paste the users list and run the Risk Analysis report themselves?
    Thanks,
    John.

    This is probably a JVM issue. Are you using JInitiator or the IE native JVM?
    I suggest you turn on the JVM console, set the trace level to maximum, and then watch what happens when you attempt the copy.
    Also, check the key mapping (usually ctrl-k) that the forms applet is implementing. Perhaps ctrl-c means something else...

  • How will i display the multiple select ids in the dashboard ?

    I have a form where there is a multiple select. When the form is submit, the ids for the multiple select is stored in the database as concatenate. For example, multiple select : 3,9,5,1.
    The ids of the multiple select is found in a table TABLE1 and the insertion is done in another table TABLE2.
    Now I have to display them in a dashboard.
    My question is how will i display the multiple select ids in the dashboard ?
    I have to do an innerjoin with TABLE1 to retrieve the names of the multiple select ids. I don't know how to do it because the column name for multiple select in TABLE2 is of type text and the column id in TABLE1 is of type int.
    Please help me solve this problem.
    Thanks in advance

    One general advice is, never store comma-delimited lists in the database. In fact, the reason is to avoid problems like the one you now face.
    The major suggestion here is to re-design your database. Make sure each selected item (for example 3, 9, 5 or 1) is stored in its own row.
    To solve the problem as it now stands, you could do something like
    <cfquery>
    select myItems
    from table2
    where id in (select id from table 1 where ...etc.)
    </cfquery>
    Then use ColdFusion's list functions to do what your dashboard requires you to do.

  • FORM MULTIPLE SELECT JAVASCRIPT

    Some folks have posted that Javascript could be used to provide a multiple-select option on a form element (users can select multiple values, which are processed into one csv string by Javascript and sent back to the appropriate column in a table)
    If you know how to do this, could you please post, step by step, how this could be accomplished. Say for a case where an employee in EMP could work in multiple departments, the DEPTNO value was a varchar and the form would enable something like 10,20,40 to be entered into the DEPTNO column via a multiple select
    I'm using 3.09

    I would also be interested in this. I've already done it the hard way...(actually it wasn't too bad after all) by writing my own function to parse the list of values and then validate them one at a time. It would be nice to be able to pick them from a list...

  • Multiple selection in JTable

    Hi ,
    The problem is to select multiple rows and columns in the JTable like that of a excel application and have the focus on the first column of the last row. for example if select cells from ( 1,1 ) to ( 4,4), after selection the focus should be in cell (4,1). i have written a prgram( which is below) which uses listSelection to find out the cells which are selected. i found out the cells which are selected also. but i do not know how to get the focus on that cell. i have attached the code below also.. i want to know whether there is any method which set the focus to the particular cell. Can the problem above can be solved in any other way..or a simpler way..
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    class myTable {
    public static void main(String a[] ) {
              JFrame myframe = new JFrame();
              JTable jtable = new JTable(10,10);
              jtable.setCellSelectionEnabled(true);
         // add the listener to the table
    ListSelectionModel listSelectionModel;
         OSSTableSelectionHandler obj = new OSSTableSelectionHandler(jtable,10,10);
         listSelectionModel = jtable.getSelectionModel();
    listSelectionModel.addListSelectionListener(obj);
         myframe.getContentPane().add(jtable);
         myframe.show();
    } // end of public static void main
    } // end of class of myTable
    class OSSTableSelectionHandler implements ListSelectionListener {
                   JTable table;
         int row;
                   int col;
    OSSTableSelectionHandler(JTable tab, int r, int c ) {
         table = tab;
    row = r;
              col = c;
    public void valueChanged(ListSelectionEvent e) {
    ListSelectionModel lsm = (ListSelectionModel)e.getSource();
                   int i = 0,j = 0;
    int firstIndex = e.getFirstIndex();
    int lastIndex = e.getLastIndex();
    boolean isAdjusting = e.getValueIsAdjusting();
    if (lsm.isSelectionEmpty()) {
    System.out.println(" Selection empty ");
    } else {
    // Find out which indexes are selected.
                        int maxrow = 0 ;
    int minIndex = lsm.getMinSelectionIndex();
    int maxIndex = lsm.getMaxSelectionIndex();
    for ( i = minIndex; i <= maxIndex; i++) {
    if (lsm.isSelectedIndex(i)) {
                                  if ( maxrow < i )
                                       maxrow = i;
                                  for (j = 0;j < col ;j++ )
                                       if ( table.isCellSelected(i,j) )
                                            System.out.println("The selected index is " + i + " " + j);
                             } // end of if                    
    } // end of for
                   // after this maxrow contains the last row that has beeb selected
                   // this for loop is to find out the first column in the maxrow that is selected
                   for (j = 0;j < col ;j ++ )
                        if ( table.isCellSelected(maxrow,j) )
                                  break;
                   // set the focus to the column ( maxrow, j )
    } // end of else
    } // end of fucn value changed
    } // end of class OSSTableSelectionHandler

    Whic cell is focused depends on where you begin your selection. The cell that you press your mouse first will be the focused one. Here is how I implement the mutiple selection functionality in a JTable as what MS Excel provides. This class is independent of my any other package. your table has to have column headers and a upper left JLabel corner(int the scroll pane containing the table) in order to make this class which I named TableSelectionAdapter function properly. You can revise and imporve it as you need, however.
    package petrochina.riped.gui.table.tableadapter;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.event.*;
    import java.awt.datatransfer.*;
    import java.util.*;
    * Enables multiple selection funtionality on <code>JTable</code>s.
    * @author Guanglin Du,SEC of Riped, PetroChina,
    * [email protected]
    * @version 1.0 2002/09/16
    public class TableSelectionAdapter extends MouseAdapter {
    private String newline = "\n";
    private boolean DEBUG = false;
    // private boolean DEBUG = true;
    private JTable myTable = null;
    private boolean shiftKeyDown = false;
    private boolean ctrlKeyDown = false;
    private int firstSelectedColIndex = -1;
    * Constructs with a <code>myTable</code> to simplify its reusability.
    * Guanglin Du, 2002/09/19
    * @param myTable     a <code>JTable</code>
    public TableSelectionAdapter(JTable myTable) {      
    this.myTable = myTable;
    initTableSelection();
    * The initTableSelection method: initializes the row/column/cell
    * selection functionality of the table.
    * Guanglin Du, 2002/09/19
    public void initTableSelection() {      
    getMyTable().setSelectionMode(
              ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
         //Cell selection
         myTable.addMouseListener(new MouseAdapter() {
         public void mousePressed(MouseEvent e) {
              myTable.setColumnSelectionAllowed(true);
              myTable.setRowSelectionAllowed(true);
         setMyKeyListener(); //shift/control key listener
         //column selection functionality
         JTableHeader myTableHeader = getMyTable().getTableHeader();
         myTableHeader.addMouseListener(new TableHeaderListener());
         //enalbles select-all functionality
         setSelectAllFunction();
    * This setSelectAllFunction isto set the select-all functionality
    * when the upper left corner label of the JTable is clicked.
    * Note: JTable's parent JScrollPane has to be found.
    * Guanglin Du, 2002/09/19
    public void setSelectAllFunction() {      
    Container firstParent = getMyTable().getParent();
    if (firstParent instanceof JViewport) {
         Container secondParent = firstParent.getParent();
         if (secondParent instanceof JScrollPane) {
         JScrollPane myScrollPane = (JScrollPane)secondParent;
         JLabel myLabel =
              (JLabel)myScrollPane.getCorner(JScrollPane.UPPER_LEFT_CORNER );
         myLabel.addMouseListener(this);
    * Detects shift/control key state.
    * DGL, 2002/09/18
    public void setMyKeyListener() {
         getMyTable().addKeyListener(new KeyAdapter(){               
         //keyPressed
         public void keyPressed(KeyEvent e){
              //shift key state
              if(e.isShiftDown())     shiftKeyDown = true;                    
              //control key state
              if(e.isControlDown()) ctrlKeyDown = true;
    //keyReleased
         public void keyReleased(KeyEvent e){
              //shift key state
              if( !e.isShiftDown() ) shiftKeyDown = false;                    
              //control key state
              if( !e.isControlDown() ) ctrlKeyDown = false;
    * Adds the table header listener to enable single/multiple column selection.
    * DGL, 2002/09/17
    public void setTableHeaderListener() {
         JTableHeader myTableHeader = myTable.getTableHeader();
         myTableHeader.addMouseListener(new TableHeaderListener());
    * Returns the <code>myTable</code> property value.
    * @return myTable the table that this class handles
    public JTable getMyTable() {
    return myTable;
    * Sets <code>myTable</code> property value of this class.
    * @param myTable the table that this class handles
    public void setJTable(JTable myTable) {
         this.myTable = myTable;
    * Returns the shiftKeyDown property value.
    * @return boolean, Guanglin Du, 2002/09/18
    public boolean getShiftKeyDown(){
         return shiftKeyDown;
    * Return the ctrlKeyDown property value.
    * @return boolean, Guanglin Du, 2002/09/18
    public boolean getCtrlKeyDown(){
         return ctrlKeyDown;
    * This inner class handles the column selection, the same
    * behavior as MS Excel.
    * Guanglin Du, 2002/09/18
    class TableHeaderListener extends MouseAdapter {
    public void mousePressed(MouseEvent e) {    
         stopLatestCellEditing(); //To save the data being edited
         if(DEBUG) System.out.print("mousePressed on ");
         JTableHeader myColumnHeader = (JTableHeader)e.getSource();
         Point myPoint = e.getPoint();
         int selectedColIndex = myColumnHeader.columnAtPoint(myPoint);
         if(DEBUG) System.out.print("the header of column "
              + selectedColIndex+newline);
         JTable table = myColumnHeader.getTable();
         //The following column selection methods work only if these
         //properties are set this way
         table.setColumnSelectionAllowed(true);
         table.setRowSelectionAllowed(false);
         int myRowCount = table.getRowCount();
         //makes this table focused, so that setMyKeyListener method can
         //listen for shift/control KeyEvent
         table.requestFocus();
    //     System.out.println("myRowCount = " + myRowCount);
         if( getShiftKeyDown() ){
         table.clearSelection();
         table.setRowSelectionInterval(0,myRowCount-1);
         table.setColumnSelectionInterval(selectedColIndex,selectedColIndex);
         if(firstSelectedColIndex > -1) {
              table.addColumnSelectionInterval(firstSelectedColIndex, selectedColIndex);
              firstSelectedColIndex = -1;//restore to -1
         } else if( getCtrlKeyDown() ) {
         table.addRowSelectionInterval(0,myRowCount-1);
         table.addColumnSelectionInterval(selectedColIndex,selectedColIndex);
         } else {
         table.clearSelection();
         table.setRowSelectionInterval(0,myRowCount-1);
         table.setColumnSelectionInterval(selectedColIndex,selectedColIndex);
         if(DEBUG) System.out.println("shiftKeyDown = " + shiftKeyDown
              +";"+" ctrlKeyDown = " + ctrlKeyDown);     
         //saves the first selected column index
         firstSelectedColIndex = selectedColIndex;
    * MouseAdapter implemenation.
    * mousePressed: sets the select-all functionality
    * when upper left corner label of the table is clicked
    * Guanglin Du, 2002/09/18
    public void mousePressed(MouseEvent e) {    
         if(DEBUG) System.out.println("Select all");
         stopLatestCellEditing();//To save the data in editing
         getMyTable().selectAll();
    * Triggers the latest <code>ActionEvent</code> in a table cell to save
    * the latest data. Or, the newly input data will not be stored into the table
    * model and cannot be retrieved.
    public void stopLatestCellEditing() {
    int editingRow = getMyTable().getEditingRow();
    int editingCol = getMyTable().getEditingColumn();
    if (editingRow != -1 && editingCol != -1){
         TableCellEditor cellEditor =
         getMyTable().getCellEditor(editingRow, editingCol);
         cellEditor.stopCellEditing();
    Here is how you can use it in your coding(where myTable is a JTable instance you create):
         /* Adds TableSelectionAdapter to enable all kinds of selection action. */
         TableSelectionAdapter tableSelect = new TableSelectionAdapter(myTable);     

  • JTable - Column swap disabling for selected columns

    Hi,
    In my JTable i want to disable the swapping of selected columns, table.getTableHeader().setReorderingAllowed(false); this disables the whole table swapping.
    Is there anyway to disable only selected column swapping?
    Thanks in advance.
    Yours,
    Arun

    I was able to disable the column swapping in all the ways, i.e. i've solved the problem that i've said in my previous post.
    The following are the scenario'scovered, if the user wants to disable swapping of 1st and 2nd column of a JTable
    1. Donot allow dragging of the 1st and 2nd column and
    2. If the user drag-drop 3 or 4 th column in place of 1st or 2nd column, then undo the swap operation by re-swapping the columns.
    Try the following example
    import java.awt.Point;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.event.MouseInputListener;
    import javax.swing.plaf.basic.BasicTableHeaderUI;
    import javax.swing.table.JTableHeader;
    import javax.swing.table.TableColumnModel;
    public class FixedTableColumnsExample
        FixedTableColumnsExample()
            String[] columnNames = {"First","Last Name","Sport","# of Years","Vegetarian"};
              Object[][] data = {
              {"Mary", "Campione","Snowboarding", new Integer(5), new Boolean(false)},
              {"Alison", "Huml","Rowing", new Integer(3), new Boolean(true)},
              {"Kathy", "Walrath","Knitting", new Integer(2), new Boolean(false)},
              {"Sharon", "Zakhour","Speed reading", new Integer(20), new Boolean(true)},
              {"Philip", "Milne","Pool", new Integer(10), new Boolean(false)}
              JTable table = new JTable(data, columnNames);
            TableColumnModel columnModel = table.getColumnModel();
            EditableHeader test = new EditableHeader(columnModel);
            table.setTableHeader(test);  
            JFrame frame = new JFrame("Table Fixed Column Demo");
            frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
            JScrollPane scrollPane = new JScrollPane(table);
            frame.getContentPane().add( scrollPane );
            frame.setSize(400, 300);
            frame.setVisible(true);
        public static void main(String[] args)
            new FixedTableColumnsExample();
    class EditableHeader extends JTableHeader
        public EditableHeader(TableColumnModel columnModel)
            super(columnModel);
        public void updateUI()
            setUI(new EditableHeaderUI());
    class EditableHeaderUI extends BasicTableHeaderUI
        boolean is1and2Swapped  = true;
        protected MouseInputListener createMouseInputListener()
            return new MouseInputHandler((EditableHeader) header);
        class MouseInputHandler extends BasicTableHeaderUI.MouseInputHandler
            protected EditableHeader header;
             public MouseInputHandler(EditableHeader header)
                 this.header = header;
             public void mouseDragged(MouseEvent e)
                 int draggedColumnIndex = ((EditableHeader)e.getSource()).getDraggedColumn().getModelIndex();
                 if(draggedColumnIndex != 0 && draggedColumnIndex != 1 )
                     super.mouseDragged(e);
                     is1and2Swapped = true;
                 else
                     is1and2Swapped = false;
             public void mouseReleased(MouseEvent e)
                 int draggedColumnIndex = ((EditableHeader)e.getSource()).getDraggedColumn().getModelIndex();
                 Point p = e.getPoint();
                 TableColumnModel columnModel = header.getColumnModel();
                 if(p.x < 0)
                     p.x = 0;
                 int index = columnModel.getColumnIndexAtX(p.x);
                 super.mouseReleased(e);
                 if((index == 0 || index == 1) && is1and2Swapped)
                   header.getColumnModel().moveColumn(index,draggedColumnIndex);
    }Is there anyother better way to do the swap disabling? If so please suggest me.
    This solution is having one disadvantage.
    Consider the following scenario,
    a) 1 and 2 are fixed columns.
    b) Move column 4 to 3rd position
    c) Move new 3rd column to 1st or 2nd column's position
    d) the new 3rd column is moving to position 4(its original position when the model was created) instead of position 3.
    This is because the TableColumModel is not updated properly. I'm working on that. Any Suggestions?
    Thanks
    Arun.

  • JTable Multiple Selection

    Hi,
    I am having a problem with the jTable's multiple selection.
    I apply cell renderers on a table's cells and also apply cell selection model on the table. I want to have mutliple row selection but I only get single selection.
    Could someone please explain why that is?
    Thanks
    Zweli
    <code>
    Utils.setupTableColumns(tblLookupProducts);
    Utils.setTableCellRenderer(tblLookupProducts, new CellToolTipRenderer(), -1);
    Utils.setCellFormatRenderer(tblLookupProducts, 5);
    Utils.setCellFormatRenderer(tblLookupProducts, 6);
    tblLookupProducts.setRowSelectionAllowed(true);
    cellSelectionModel = tblLookupProducts.getSelectionModel();
    cellSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    public class CellToolTipRenderer extends DefaultTableCellRenderer {
    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
    boolean hasFocus, int row, int col) {
    Component comp = super.getTableCellRendererComponent(
    table, value, isSelected, hasFocus, row, col);
    comp.setForeground(Color.black);
    comp.setBackground(Color.white);
    if (table.getSelectedRow() == row) {
    comp.setBackground(table.getSelectionBackground());
    comp.setForeground(Color.WHITE);
    setToolTipText(table.getModel().getValueAt(row, col).toString());
    return comp;
    * @author Zweli
    public class CellAlignmentRenderer extends DefaultTableCellRenderer {
    private int column;
    private NumberFormat currency = NumberFormat.getNumberInstance();
    private DecimalFormat df = new DecimalFormat("#,###,###,##0.00");
    private BigDecimal bd;
    public CellAlignmentRenderer(int column) {
    this.column = column;
    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
    boolean hasFocus, int row, int col) {
    Component comp = super.getTableCellRendererComponent(
    table, value, isSelected, hasFocus, row, col);
    comp.setForeground(Color.black);
    comp.setBackground(Color.white);
    if (table.getSelectedRow() == row) {
    comp.setBackground(table.getSelectionBackground());
    comp.setForeground(Color.WHITE);
    if (row != -1) {
    setHorizontalAlignment(SwingConstants.RIGHT);
    setToolTipText(table.getModel().getValueAt(row, col).toString());
    return comp;
    </code>

    Hello,
    Please edit your post and use proper tags.
    +if (table.getSelectedRow() == row) {+
    From the JTable API Javadoc:
    getSelectedRow()
    Returns the index of the first selected row, -1 if no row is selected.
    So this only returns +one+ index among all those selected.
    You could use <tt>getSelectedRows()</tt> (notice the +s+ !) instead, but there's a much better approach: guess what the +isSelected+ argument to <tt>getTableCellRendererComponent(...)</tt> stands for :o)
    Regards.
        J.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Multiple selection in JTable for deletion

    Dears,
    I'm using Jdeveloper 9.0.3.3 on 8.1.7 Oracle DB.
    I noticed that when a JTable is bound to a View object ==> only one row can be selected.
    My situation -which I think is very common- I have a screen with JTable where I can edit a row and commit my updates or select multiple selection in JTable and delete them at once ; thats what I need.
    It is very like the test of any application module but allow multiple selection and deletion in JTable for user's selected rows.
    How this could be done in JClient?
    Thankx in advance.

    Thanks for your suggestions! They both would work as workarounds, I think. I tried another way:
    Following code changes a TableBinding bound JTable's selection model to Multi select (thanks to Shailesh!!).
    void setMultiSelectionModel(JTable tbl)
    class MultiSelectionListListener implements javax.swing.event.ListSelectionListener
    ListSelectionModel defSelModel;
    MultiSelectionListListener(ListSelectionModel model)
    defSelModel = model;
    public void valueChanged(javax.swing.event.ListSelectionEvent e)
    if (!e.getValueIsAdjusting())
    ListSelectionModel listModel = (ListSelectionModel)e.getSource();
    int leadIndex = listModel.getLeadSelectionIndex();
    if (leadIndex == listModel.getAnchorSelectionIndex()
    && leadIndex == listModel.getMaxSelectionIndex()
    && leadIndex == listModel.getMinSelectionIndex())
    //change currency on the bound iterator only if
    //one row is being selected.
    defSelModel.setSelectionInterval(leadIndex, leadIndex);
    ListSelectionModel newModel = new DefaultListSelectionModel();
    newModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    newModel.addListSelectionListener(new MultiSelectionListListener(tbl.getSelectionModel()));
    tbl.setSelectionModel(newModel);
    This fixes the bug if you select some rows and then select a row before the first selected one. Seems to work great.

  • Scroll Fix Column in JTable

    I have see a lots of examples of whow to create fix column into JTable.
    But all the examples have the same problems.
    When I wont to scroll over the fix column the vertical scroll bar of the no fix column dont move, so the no fix column dose not move and the fix columns and no fix columns aren?t alined.
    If sameone have same example, send it please !!!!
    Thanks !!!
    Pablo

    In a recent project I've had the same problem.
    After a long research at the Swing forum at java.sun.org and google I found out that
    1. Currently there is no proper Open Source solution
    2. All the postings at sun are good concepts, but far away from solutions
    3. The only (for me )acceptable commercial solution is the JCTable from Quest (formerly KGroup)
    Since I want to have full control over the source code of the table, I decided to collect all the tips from this forums and write my own table.
    Here is a first try:
    http://jroller.com/resources/kriede/CoolTable.java
    The main idea is to have two tables, one for the locked columns (= fixed columns = frozen columns) and one for the scrollable columns. With all the tips from this forum it was more or less a puzzle to make it work pretty.

  • How do I strip special characters in SSRS for Lookup columns with Multiple Selections?

    Hello all,
    Please let me know if I am posting in the wrong location.
    I am building reports against my SharePoint List (actually a library).  1 of the columns I want to display in the report is a Lookup column that allows Multiple lookups.  Problem is that the SharePoint Web Service call GetListItems returns the values with the item id and ";#" combination.  For example:
    122;#Apple;#112;#Carrot
    but I need the following format:
    Apple, Carrot
    Following this great article posting - http://www.sharepointu.com/dwise/archive/2007/11/28/connecting-sql-reporting-services-to-a-sharepoint-list-redux.aspx
    I was able to drop the first part using the following code
    function GetNameFromSP(pFullID as string) as string
      dim strRet as string
      dim iPos as integer
      if pFullID = nothing then return ""
      if pFullID = "" then return ""
      iPos = Instr(pFullID, ";")
      if iPos < 1 then return pFullID
      return Mid(pFullID, iPos +2)
    end function
    But it does not replace the subsquent id references.
    Anyone done this before that can provide me tips?
    Thanks!
    Jeff Kozloff
    Project Manager, Solutions Team
    Bamboo Solutions
    http://www.bamboosolutions.com

    All,
    Here is the updated code that resolves my issue (a coworker of mine provided the following code):
    Function TrimMultiLookup(ByVal s As String) As String
            Dim combStr As String
            Dim array As String()
            Dim c As Integer
            combStr = String.Empty
            array = Split(s, ";#")
            Console.WriteLine(array.Length)
            For c = 1 To array.Length - 1 Step 2
                combStr += array(c) + ", "
            Next
            Return Left(combStr, combStr.Length - 2)
        End Function
    Jeff Kozloff
    Project Manager, Solutions Team
    Bamboo Solutions
    http://www.bamboosolutions.com

  • (JTable) How can i get the first columns cell in a selected row?

    Hello. I am trying to figure out how i can get the first columns cell within a selected row no matter what cell is selected in that row. I have a class that extends AbstractTableModel which represents the table. Now i have another class that extends DefaultSelectionModel. Each model is added to the JTable via setModel(TableModel dataModel), setSelectionModel(ListSelectionModel newModel). Now i don't understand what i have to return from getMaxSelectionIndex(). Any ides? Thanks.
      class xTableModel extends AbstractTableModel{
         private static String[] cols;
         private Object[][] data;
            public void setTableModel(Object data[][], String[] cols){
             this.cols = cols;
             this.data = data;
            public String getColumnName(int col){
             return cols[col];
            public int getRowCount() {
             return data.length;
            public Object getValueAt(int row, int col) {
             return data[row][col];           
            public void setValueAt(Object value,int row,int col){
             data[row][col]=value;
            public int getColumnCount(){
             return cols.length;
    class ColumnListenerModel extends DefaultListSelectionModel{
         public int getMaxSelectionIndex(){}

    int row = table.getSelectedRow();
    Object data = table.getValueAt(row, 0);

Maybe you are looking for

  • What to do when SLS - Lion Server Upgrade & Migration Fail

    Hi everyone, I've had a tough time over the past week trying to updating my SLS to LS. (It was a slow week at the office so despite the warnings in these discussions I wasn't disturbing anyone, so I thought I'd try...) Both an upgrade to the current

  • File Adapter Issue

    In file adapter Source system having 7 columns and Target system having 6 columns? how to synchronise it? Edited by: 995694 on Apr 5, 2013 9:33 PM

  • Add new field to CEKKO in exit EXIT_SAPLEBND_002

    Hi, Can i include a zinclude in the structre of CEKKO in exit EXIT_SAPLEBND_002. I have to assign KTOKK filed from LFA! table to CEKKO structure. I have an inclue in the structure CEKKO as ZCEKKO_KNTTP,can I include the new field there. please advice

  • Data Sync stuck in processing

    Can you please delete my data sync? I tried to cancel the data sync, so I could delete it but it has been stuck in processing for almost 24 hours now. The subscription id is 2b362515-3f77-44fc-9803-08334705d01a and the sync group is called DevSyncGro

  • Related to MM03

    Hi friends, i need to call transaction MM03 when user double clicks on the material number . so i have used : set parameter id 'MAT'  field  matnr. call transaction 'MM03' and skip first screen. it is calling the transaction properly with correspondi