Sorting selected cells

When i have several cells selected, i only want that selection to be sorted...
that is very crucial to me, for many of my old sheets from AppleWorks have tables and on the right hand top, some statistical overviews. what happens now is when sorting the data table, it sorts the rows included in the selection, but it sorts the complete row and thus placing my overview scattered in the spreadsheet
is there an other way of getting this fixed, or do i need to setup a sheet with two tables, one with data and one with the resulting overview?

Then that implies that data doesn't actually belong in that table. In Numbers only related data that should be noted next to each other should be in one table. You can then recombine the data into one final results table that brings data from multiple data tables together.
Think data base. You would never try to do that kind of thing in a relational database. only data that belongs together is stored in fields together. You then combine different tables data into one results "Query".
Does this help straighten it out a little bit? Things we have learned in Excel are actually bad habits when it comes to data integrity.
Jason

Similar Messages

  • Sort only selected cells?

    I would like to sort alphabetically only a selected column of cells.  I don't want to sort other items in the rows.  I can't seem to find any combination in reorganize that works.

    And if you find it difficult or disconcerting to rip a column out of the table, you can:
    click on any cell to show the column and row reference tabs.
    click the tab for the target column to select the whole column
    copy
    click on an empty space in the sheet (ie. not on a table
    paste (this creates a new, single column table containing the copied data)
    sort
    select the whole column
    copy
    click on the top cell of the original data column
    paste.
    Note that this will work only with data that has been entered directly. If the data has been created by formulas in the original cells, the formulas will break when the cell content is pastede into a new table.
    Regards,
    Barry
    PS: Overall, I prefer Jerry's suggestion. I do have occasional difficulty finding the 'sweet spot' when separating a column from the rest of its original table, though, and have sometimes used this alternate method.

  • How to disable selective cells in a column of a table?

    Hi
    I have a Table UI element having 5 columns. 4 of this are non-editable and only one is editable i.e. having input field . The data is picked from the backend. The 5th column also gets default data from the backend, which the user can later on change.
    But there is a condition, that only the input fields from that row onwards should remain enabled whose month field matches the current month. Rest all should become disabled or invisible.
    I worte the code in the wdModifyView() which picks the current date, and then in a loop it checks all the rows for the condition. If it matches the condition, it comes out of the loop, else it sets the enable property of input field to false.
    But when i run this application, all the cells become disabled, not selective cells.
    Is there a way in which I can sort this problem, any API using which i can access each cell by its row number and column number and then disable it.
    If anybody could please help, it is urgent.
    Thanks & regards,
    Anupreet

    Anupreet,
    Create a subnode with cardinality 1..1 and boolean attribute IsEnabled right under your data node. Write a supply function for this subnode, and set boolean attribute value depending on month in parentElement (parameter of supply function). Then bind InputField "enabled" property to this boolean attribute.
    VS

  • How do I print or export only selected cells in Numbers?

    Does anyone know how to do this in Numbers? I have been trying to do this for well over an hour...... I have looked at other posters' questions first, all the way back to 2008 in fact. The closest I have seen to an answer (and it is a workaround, not a true answer) is copy the selected cells into a new sheet. I have been using software spreadsheets (Lotus 123 and later Excel) going back to the mid-1980's. I cannot remember the last time I could not do this.
    Friends, I do realize that many of the workarounds would have taken far less time than what I have invested, please do not feel the need to point that out. I am heading for a workaround right now as I have run out of time to devote to this task. Also, please do not suggest that I should "capture" the data by copying a screen shot to the clipboard or have it dump a .png on my desktop. Most of us here should know how to do that by now but that does not address the underlying issue of how to provide only a select piece of a spreadsheet to a 3rd party in a professional looking format. Well, off to copy and paste........
    Thanks in advance,
    Bill G.
    Update (15 min later):
    Boy, I hope one of you out there knows the solution to this. Copy and paste the selected area does not work either. You lose (this was an "Oh, duh!" sort of moment BTW) any figures populated by calculations not in the selection area.
    Need to go eat, will try to feed the values in the new table from the same calculations in the first table. I can do that easily in Excel, I just have not tried it yet in Numbers. I am optomistic that it will work.
    Thanks again,
    Bill G.

    As I'm lazy, I use this script and paste where I want.
    --{code}
    set the clipboard to (the clipboard as «class PDF »)
    --{code}
    I  made a test which gave a funny result.
    Given a Numbers document with a chart.
    I selected the chart, the title and the legends
    then I grouped these objects.
    Select all
    copy
    run the script
    I pasted in the sheet to be able to take a screenshot.
    It's a bit inconsistent.
    Text values are passed when they are in cells
    They are passed when they are used as value labels in the chart
    but they aren't passed when they are chart's title or legend's components.
    Funny behavior, the graphic symbols are moved in the process to the location where they would be if the text components were nil strings.
    No comment upon a table's title which can't be selected with the table itself.
    Yvan KOENIG (VALLAURIS, France) lundi 3 octobre 2011 14:01:20
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • How do I change the colour of a selected cell in a jTable?

    I have a Jtable that displays URL names in one column. There are several problems I'm having. The effect I'm trying to achieve is this:
    When the user runs the mouse over the URL name the cursor should change into a hand (similar to what happens in an HTML hyperlink). I'm aware that the Cursor class can set the cursor graphic so i figure that i need a listener of some sort on each cell (so the cursor can change from an arrow to a hand) and also one to indicate when the cursor is not on a cell (so that it can change from a hand back into an arrow). Is this the right track?
    Also, I've looked at the DefaultTableCellRenderer class (which, as i understand it, is responsible for how each cell in the jtable is displayed) for a method that will allow me to set the background of a selected cell (or row or column). I require this because each time i select a cell (or row) it becomes highlighted in blue. I would rather it just remained white and changed the cursor to a hand. I know there exists a method for setting the background for an unselected cell but none for a selected cell. Again, I'm not sure if I'm going down the right track with this approach.
    Lastly, if the cell has been selected (by a mouse click) the font of the writing in the cell (i.e. The name of the URL) should change. This shouldn't be too much of a problem I think.
    I do not expect anyone to provide code to do all of this but some general pointers would be extremely helpful as I do not know if I'm thinking on the right track for any of this. Having some (limited) experience with Swing I doubt there is a simple way to do this but I can only hope!
    Thanks.
    Chris

    http://www2.gol.com/users/tame/swing/examples/SwingExamples.html
    there you can find some examples with CellRenderer's and so on ...
    have fun

  • How to i print only selected cells in a spreadsheet?

    How do you print only selected cells in a spreadsheet using Numbers?

    The easiest way is to export it to Excel and save that file to a Windows machine. Then, File->Print Selection. Kidding. Sort of. Like all of the Apple "productivity" software, Numbers has about a thousand things no one uses and does not have the simple things one wants.

  • How do I sort specific cells without affecting entire rows?

    In Excel I can sort specific cells ascending/descending and only what I highlight will sort.
    In Numbers, when I try to do that the entire row sorts.
    Is there a way to only sort the highlighted cells and not have the rest of the rows sort as well?

    Here's a link (Dropbox download) to a Copy Sort Acending service, that in your menu would look similar to this:
    To use it, select the cells you want to sort, just as in Excel, and make the choice from the menu.
    After that, unlike Excel, click once in the first cell where you want the sorted values to start appearing (either the original range, or a different range if you want) and type command-v or option-shift-command-v to paste.
    The one-time installation takes a double-click on the .workflow package and a click on 'Install'. You may also have to go to System Preferences > Security & Privacy and click 'Download anyway'.  Installing simply moves the service to your Library > Services folder so that it will appear in your menu. It does nothing to the innards of your Mac, and does not run unless you specifically tell it to by choosing it from the menu or running it from within Automator. You can view the script by opening it in Automator.  You can remove the service if you don't need it by holding down the option key in Finder, choosing Go from the menu and navigating to Library > Services, where you can delete it the way you would any other folder or package.
    SG

  • Selecting cell when invoke popup

    I have a table where the user can select the table cells with a mouse click, if they do a right click its brings up a PopupMenu but this doesnt effect what cells have been selected.
    Ive looked at Microsoft Spreadsheet and if a right click is done over a cell that has been selected, all the cells selected remains but if it is clicked over a cell that is not selected then the cell that has just been clicked on becomes the current cell instead.
    This seems a better way of doing it., so does anyone know how I can achieve this prefereably in a way that is both OS independent and input device independent.
    Thanks Paul

    Thanks
    Ive posted my soln based on your info here. Its maybe more complicated then would uusually be required because my table allows row and column sorting.
    protected void maybeShowPopup(MouseEvent e)
            /** Get selected cells
             *  have we clicked over area covered by selected cells
             *  if not we then reset to currently covered cell
            if (e.isPopupTrigger())
                try
                    int row = table.rowAtPoint(e.getPoint());
                    int col = table.columnAtPoint(e.getPoint());
                    CellLocation cell
                        = new CellLocation( ( (TableSorter) table.getModel()).getRowAt(row),
                                           table.getColumnModel().getColumn(col).getModelIndex());
                    ArrayList cells = ( (TableSorter) table.getModel()).getSelectedCells();
                    if (!cells.contains(cell))
                         table.changeSelection(row, col, false, false);
                catch (Exception ex)
                    ex.printStackTrace();
                popup.show(e.getComponent(), e.getX(), e.getY());
    class CellLocation
         int row;
         int col;
         public CellLocation(int row, int col)
             this.row = row;
             this.col = col;
         public int getRow()
             return row;
         public int getCol()
             return col;
         public boolean equals(Object o)
             CellLocation otherCell = (CellLocation)o;
             if((otherCell.getRow()==this.getRow())&&
                (otherCell.getCol()==this.getCol())
                 return true;
             return false;
    Table Sorter methods ........
    /** Returns the underlying model row index for a given table row index */
        public int getRowAt(int aRow)
            return  ((Integer) indexes.get(aRow)).intValue();
        /* The mapping only affects the contents of the data rows.
         * Pass all requests to these rows through the mapping array: "indexes".
        public Object getValueAt(int aRow, int aColumn)
            checkModel();
            return model.getValueAt( ( (Integer) indexes.get(aRow)).intValue(), aColumn);
        /** Retrieve a list of the selected cells */
        public ArrayList getSelectedCells()
            ArrayList selectedCells = new ArrayList();
            try
                int[] rows = table.getSelectedRows();
                for (int i = 0; i < rows.length; i++)
                    int[] cols = table.getSelectedColumns();
                    for (int j = 0; j < cols.length; j++)
                        selectedCells.add(new CellLocation( ( (Integer) indexes.get(rows)).intValue()
    , table.getColumnModel().getColumn(cols[j]).getModelIndex()));
    catch (Exception e)
    e.printStackTrace();
    return selectedCells;

  • How to print selected cells in numbers

    Does anyone know how to print selected cells in a Numbers spreadsheet, rather than printing the entire sheet?
    Also, how to save the selected cells as a pdf file without saving the irrelevant cells?

    Hi nmygs,
    How about this?
    Cell A1 is a Pop-Up Menu containing names of the various "Departments"
    Other cells contain formulas to find a match for whatever is chosen in A1 from the Very Big Data Table.
    Reusable Print Me table.
    Regards,
    Ian.

  • Get Current Selected Cell Value in an af:table

    Using JDeveloper 11.1.1.3.0
    I currently have a requirement where i need to call a server method and pass the value of the current selected Cell value in my af:table.
    The reason why i can't just make use of the currentSelectedRow is because i have a set of Columns (NumericValue1,NumericValue12,...NumericValue1n) and my server method can't really tell which cell i picked.
    So far, what i did is that i utilized F. Nimphius's article about using contextMenu and passing a clientAttribute.
    Re: How to pass parameter to inline popup when mouse over
    I'm hoping to do the same thing but without raising a popup on right click. So basically, i'm hoping to select an outputText in the table and this value will be stored in a pageFlowScopeBean.
    Has anybody encountered something similar?
    Thanks.

    Hi Barbara,
    You're aproach sounds intersting.
    So you mean to say, i'll create a component which has a bindings to my pageDefinition which needs to have it's clientComponent attribute set to true i believe so that my javascript can find this component.
    Then, i'll write a javascript that handles the focus event which then stores the clientAttribute value and stores that in the hidden component mentioned earlier. I'm guessing that once i set the newValue to the hidden component, it should be posted to the pageDef bindings upon hitting server side calls.
    I'll try this out and give an update on it.

  • Selecting cells in a JTable

    Hi All,
    I'm looking for a way of selecting all cells from the original drag point to the current cell that the mouse is over.
    This is for a year planner which displays the months vertcally and the days horizontally. So if the user was to start selecting cells in one month and move the mouse down a row onto the next month, I would want all cells selected from the first cell to the current cell.
    Has anyone got any ideas?

    Hi Pchatwin,
    Any dukes available for bad news? :)
    Thanks Stas but wouldn't that select entire rows
    rather than cells?
    For example, if I have a grid:
    12345
    67890
    and drag from cell 3 to cell 9 I would need to see
    cells 3, 4, 5, 6, 7, 8, 9 highlightedUnfortunately this is impossible with JTable's default selection model. By default, JTable models selections simply as an intersection of selected rows and columns. It doesn't track individual cells.
    Turning to your example:
    If you select cells 2,3,4,5 JTable tracks the following.
    Note: The numbers I am using are row/col indexes, not your cell values.
    Selected rows = {0}
    Selected cols = {1,2,3,4}
    This means the following cells are selected:
    {{0,1},{0,2},{0,3},{0,4}} or {2,3,4,5}
    Now if you want to add cells 6, 7, 8, 9 it won't work. The selection model tracks whether a column is selected or not. It can't be selected for one row and not for another. So it's impossible to have cell 6 selected and not 1. It would mean that column 0 would need to be both selected (to include 6) and not (to include 1). Does this make sense?
    Sorry to have to tell you that. On the other hand it may save you some frustration.
    Oh, and whether or not one can provide a custom model that allows this, I don't know - I've not tried it myself. It could be, but might be very difficult. For example, what would you return from JTable.getSelectedRows()?
    Thanks!
    Shannon Hickey (Swing Team)
    >
    Paul

  • How do i print selected cells in numbers?

    how do i print selected cells in numbers?

    As I'm lazy, I use this script and paste where I want.
    --{code}
    set the clipboard to (the clipboard as «class PDF »)
    --{code}
    I  made a test which gave a funny result.
    Given a Numbers document with a chart.
    I selected the chart, the title and the legends
    then I grouped these objects.
    Select all
    copy
    run the script
    I pasted in the sheet to be able to take a screenshot.
    It's a bit inconsistent.
    Text values are passed when they are in cells
    They are passed when they are used as value labels in the chart
    but they aren't passed when they are chart's title or legend's components.
    Funny behavior, the graphic symbols are moved in the process to the location where they would be if the text components were nil strings.
    No comment upon a table's title which can't be selected with the table itself.
    Yvan KOENIG (VALLAURIS, France) lundi 3 octobre 2011 14:01:20
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • How to outline selected cells during drag and drop in the jtable

    Hi,
    I have spent a lot of time to find out how to outline selected cells during drag in the jtable, but I did not find the answer.
    Can anybody give me a tip, where to read more about this problem or even better, give an example...
    I have the following situation:
    1.Table has 10 rows and 10 columns
    2.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION) and setCellSelectionEnabled(true)
    3.user select 5 cells in 4th row (for example cell45,cell46,cell47,cell48 and cell49)
    4.user starts dragging. During dragging an outline should be drawn. Outline should be a rectangular with width of 5 cells and height of one cell. Outline should move according to the mouse position.
    5.rectangular disappears when dropped
    Regards,
    Primoz

    In "createTransferable" you can create a drag image
    which you can paint in "dragOver" and clear in "drop" method of DropTarget :
    package dnd;
    * DragDropJTableCellContents.java
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.datatransfer.*;
    import java.awt.dnd.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import java.io.IOException;
    public class DragDropJTableCellContents extends JFrame {
        public DragDropJTableCellContents() {
            setTitle("Drag and Drop JTable");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            getContentPane().add(createTable("JTable"), BorderLayout.CENTER);
            setSize(400, 300);
            setLocationRelativeTo(null);
        private JPanel createTable(String tableId) {
            DefaultTableModel model = new DefaultTableModel();
            for (int i = 0; i < 10; i++) {
                model.addColumn("Column "+i);
            for (int i = 0; i < 10; i++) {
                String[] rowData = new String[10];
                for (int j = 0; j < 10; j++) {
                    rowData[j] = tableId + " " + i + j;
                model.addRow(rowData);
            JTable table = new JTable(model);
            table.getTableHeader().setReorderingAllowed(false);
            table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
            table.setCellSelectionEnabled(true);
            JScrollPane scrollPane = new JScrollPane(table);
            table.setDragEnabled(true);
            TableTransferHandler th = new TableTransferHandler();
            table.setTransferHandler(th);
            table.setDropTarget(new TableDropTarget(th));
            table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            JPanel panel = new JPanel(new BorderLayout());
            panel.add(scrollPane);
            panel.setBorder(BorderFactory.createTitledBorder(tableId));
            return panel;
        public static void main(String[] args) {
            new DragDropJTableCellContents().setVisible(true);
        abstract class StringTransferHandler extends TransferHandler {
            public int dropAction;
            protected abstract String exportString(JComponent c);
            protected abstract void importString(JComponent c, String str);
            @Override
            protected Transferable createTransferable(JComponent c) {
                return new StringSelection(exportString(c));
            @Override
            public int getSourceActions(JComponent c) {
                return COPY;
            @Override
            public boolean importData(JComponent c, Transferable t) {
                if (canImport(c, t.getTransferDataFlavors())) {
                    try {
                        String str = (String) t.getTransferData(DataFlavor.stringFlavor);
                        importString(c, str);
                        return true;
                    } catch (UnsupportedFlavorException ufe) {
                    } catch (IOException ioe) {
                return false;
            @Override
            public boolean canImport(JComponent c, DataFlavor[] flavors) {
                for (int ndx = 0; ndx < flavors.length; ndx++) {
                    if (DataFlavor.stringFlavor.equals(flavors[ndx])) {
                        return true;
                return false;
        class TableTransferHandler extends StringTransferHandler {
            private int dragRow;
            private int[] dragColumns;
            private BufferedImage[] image;
            private int row;
            private int[] columns;
            public JTable target;
            @Override
            protected Transferable createTransferable(JComponent c) {
                JTable table = (JTable) c;
                dragRow = table.getSelectedRow();
                dragColumns = table.getSelectedColumns();
                createDragImage(table);
                return new StringSelection(exportString(c));
            protected String exportString(JComponent c) {
                JTable table = (JTable) c;
                row = table.getSelectedRow();
                columns = table.getSelectedColumns();
                StringBuffer buff = new StringBuffer();
                for (int j = 0; j < columns.length; j++) {
                    Object val = table.getValueAt(row, columns[j]);
                    buff.append(val == null ? "" : val.toString());
                    if (j != columns.length - 1) {
                        buff.append(",");
                return buff.toString();
            protected void importString(JComponent c, String str) {
                target = (JTable) c;
                DefaultTableModel model = (DefaultTableModel) target.getModel();
                String[] values = str.split("\n");
                int colCount = target.getSelectedColumn();
                int max = target.getColumnCount();
                for (int ndx = 0; ndx < values.length; ndx++) {
                    String[] data = values[ndx].split(",");
                    for (int i = 0; i < data.length; i++) {
                        String string = data;
    if(colCount < max){
    model.setValueAt(string, target.getSelectedRow(), colCount);
    colCount++;
    public BufferedImage[] getDragImage() {
    return image;
    private void createDragImage(JTable table) {
    if (dragColumns != null) {
    try {
    image = new BufferedImage[dragColumns.length];
    for (int i = 0; i < dragColumns.length; i++) {
    Rectangle cellBounds = table.getCellRect(dragRow, i, true);
    TableCellRenderer r = table.getCellRenderer(dragRow, i);
    DefaultTableModel m = (DefaultTableModel) table.getModel();
    JComponent lbl = (JComponent) r.getTableCellRendererComponent(table,
    table.getValueAt(dragRow, dragColumns[i]), false, false, dragRow, i);
    lbl.setBounds(cellBounds);
    BufferedImage img = new BufferedImage(lbl.getWidth(), lbl.getHeight(),
    BufferedImage.TYPE_INT_ARGB_PRE);
    Graphics2D graphics = img.createGraphics();
    graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f));
    lbl.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
    lbl.paint(graphics);
    graphics.dispose();
    image[i] = img;
    } catch (RuntimeException re) {
    class TableDropTarget extends DropTarget {
    private Insets autoscrollInsets = new Insets(20, 20, 20, 20);
    private Rectangle rect2D = new Rectangle();
    private TableTransferHandler handler;
    public TableDropTarget(TableTransferHandler h) {
    super();
    this.handler = h;
    @Override
    public void dragOver(DropTargetDragEvent dtde) {
    handler.dropAction = dtde.getDropAction();
    JTable table = (JTable) dtde.getDropTargetContext().getComponent();
    Point location = dtde.getLocation();
    int row = table.rowAtPoint(location);
    int column = table.columnAtPoint(location);
    table.changeSelection(row, column, false, false);
    paintImage(table, location);
    autoscroll(table, location);
    super.dragOver(dtde);
    public void dragExit(DropTargetDragEvent dtde) {
    clearImage((JTable) dtde.getDropTargetContext().getComponent());
    super.dragExit(dtde);
    @Override
    public void drop(DropTargetDropEvent dtde) {
    Transferable data = dtde.getTransferable();
    JTable table = (JTable) dtde.getDropTargetContext().getComponent();
    clearImage(table);
    handler.importData(table, data);
    super.drop(dtde);
    private final void paintImage(JTable table, Point location) {
    Point pt = new Point(location);
    BufferedImage[] image = handler.getDragImage();
    if (image != null) {
    table.paintImmediately(rect2D.getBounds());
    rect2D.setLocation(pt.x - 15, pt.y - 15);
    int wRect2D = 0;
    int hRect2D = 0;
    for (int i = 0; i < image.length; i++) {
    table.getGraphics().drawImage(image[i], pt.x - 15, pt.y - 15, table);
    pt.x += image[i].getWidth();
    if (hRect2D < image[i].getHeight()) {
    hRect2D = image[i].getHeight();
    wRect2D += image[i].getWidth();
    rect2D.setSize(wRect2D, hRect2D);
    private final void clearImage(JTable table) {
    table.paintImmediately(rect2D.getBounds());
    private Insets getAutoscrollInsets() {
    return autoscrollInsets;
    private void autoscroll(JTable table, Point cursorLocation) {
    Insets insets = getAutoscrollInsets();
    Rectangle outer = table.getVisibleRect();
    Rectangle inner = new Rectangle(outer.x + insets.left,
    outer.y + insets.top,
    outer.width - (insets.left + insets.right),
    outer.height - (insets.top + insets.bottom));
    if (!inner.contains(cursorLocation)) {
    Rectangle scrollRect = new Rectangle(cursorLocation.x - insets.left,
    cursorLocation.y - insets.top,
    insets.left + insets.right,
    insets.top + insets.bottom);
    table.scrollRectToVisible(scrollRect);
    Edited by: Andre_Uhres on Nov 18, 2007 10:03 PM

  • A problem to get the value of a selected cell

    Hi all,
    I am trying to get the value of a cell in JTable. The problem that I have is ListSelectionListener only listens if the selection changes(valueChanged method).
    It means that if I select apple then rum, only rowSelectionModel is triggered, which means I do not get the index of the column from selectionModel of ColumnModel.
    apple orange plum
    rum sky blue
    This is a piece of code from JTable tutorial that I modified by adding
    selRow and selCol variables to keep track of the location so that I can get the value of the selected cell.
    Thank you.
    if (ALLOW_ROW_SELECTION) { // true by default
    ListSelectionModel rowSM = table.getSelectionModel();
    rowSM.addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting()) return;
    ListSelectionModel lsm = (ListSelectionModel)e.getSource();
    if (lsm.isSelectionEmpty()) {
    System.out.println("No rows are selected.");
    } else {
    int selectedRow = lsm.getMinSelectionIndex();
    selRow = selectedRow;
    System.out.println("Row " + selectedRow + " is now selected.");
    else {
    table.setRowSelectionAllowed(false);
    if (ALLOW_COLUMN_SELECTION) { // false by default
    if (ALLOW_ROW_SELECTION) {
    table.setCellSelectionEnabled(true);
    table.setColumnSelectionAllowed(true);
    ListSelectionModel colSM = table.getColumnModel().getSelectionModel();
    colSM.addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
    //Ignore extra messages.
    if (e.getValueIsAdjusting()) return;
    ListSelectionModel lsm = (ListSelectionModel)e.getSource();
    if (lsm.isSelectionEmpty()) {
    System.out.println("No columns are selected.");
    } else {
    int selectedCol = lsm.getMinSelectionIndex();
    selCol = selectedCol;
    System.out.println("Column " + selCol + " is now selected.");
    System.out.println("Row " + selRow + " is now selected.");
    javax.swing.table.TableModel model = table.getModel();
    // I get the value here
    System.out.println("Value: "+model.getValueAt(selRow,selCol));
    }

    maybe you can try with :
    table.getSelectedColumn()
    table.getSelectedRow()
    :)

  • How to get the position of a selected cell in a table ?

    Hi,
    How can I get the position of a selected cell in a table or in a list multicolumn cmd ?
    Thanks.

    Invoke node >>> point to Row Column
    Ben
    Message Edited by Ben on 07-19-2007 03:14 PM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    Point_To_Row_Column.PNG ‏22 KB

Maybe you are looking for

  • Print link on report shows 'no data found' when LOV has not been used

    Hi all, I have a simple standard report that queries data based on the value in a Select List. This Select List allows users to pick a year for the report. The LOV has a default of TO_CHAR(SYSDATE,'YYYY'). If I open the page using the associated Tab

  • Adobe Acrobat 9 Pro - Form Wizard isn't detecting form fields?

    Hi there, I've been scouring various forums, blogs, etc. to find an answer to my problem, and have yet to be successful.  Here it is: I've created a form in Illustrator CS5 using the rectangle shape tool to indicate form fields.  I need users to be a

  • Hierachichal display is not coming for field in cross tab crystal report

    Hi, I have a dimension  "Cost center" in DSO on which Hierarchy is defined in SAP BI. When I developed one cross tab report on this DSO, values for Cost Center fields are displayed in flat mode and not in Hierarchical mode. I also set group option on

  • Power failure then iPhoto library= POOF! :-(    PLEASE HELP!

    Power failure then iPhoto> library= POOF! We had a power failure and of course iPhoto was open when my computer was improperly shut down. After powering up, I did the following; repaired permissions and ran disk utility (no problems found). Upon open

  • Error running an interactive form example

    Hi everyone, I'm trying to run a basic AIF scenario on a local machine. I created a web dynypro example according to the Guide "How to Create Online and Offline Forms in Web Dynpro". I configured the Adobe Document Services and my credential as descr