Cell contents selected on focus in JTable

I'm new to swing and trying to get the contents of a JTable cell to be selected when the cell receives focus. I've looked at the TableCellEditor interface and the like, but I just can't seem to get the hang of how it all fits together. Any hits would be appreciated. Thanks.

There are several ways to do this, but here is one to get you started:
First, subclass DefaultCellEditor. Here, I have duplicated all the constructors from DefaultCellEditor but only modified the one used for text.
I have added a inner class, FocusEventHandler, to capture the focus events. In the focusGained method is the code to do the selectAll. (I use the invokeLater so that the selectAll happens after pending events are complete. A mouse click might be interpreted by the text box to position the cursor, so we want the selectAll to happen after that.)
Then, in the constructor for text, I save the text box so the focusGained method knows which text box to selectAll for, register the event handler, and (optionally) change the ClickCountToStart.
public class NewDefaultCellEditor extends javax.swing.DefaultCellEditor {
javax.swing.JTextField saveTextField = null;
// Event handler
public class FocusEventHandler implements java.awt.event.FocusListener {
     public void focusGained(java.awt.event.FocusEvent e) {
          javax.swing.SwingUtilities.invokeLater(new Runnable () {public void run() {saveTextField.selectAll();}});
     public void focusLost(java.awt.event.FocusEvent e) {}
// Constructors
public NewDefaultCellEditor(javax.swing.JCheckBox checkBox) {
     super(checkBox);
public NewDefaultCellEditor(javax.swing.JComboBox comboBox) {
     super(comboBox);
public NewDefaultCellEditor(javax.swing.JTextField textField) {
     super(textField);
     saveTextField = textField; // save text field for later
     textField.addFocusListener(new FocusEventHandler()); // register event handler
     setClickCountToStart(1); // change # of mouse clicks to begin editing
}Now you just have to tell the table to use this Cell Editor. One way to do this is:
MyTable.getColumnModel().getColumn(0).setCellEditor(new NewDefaultCellEditor(new javax.swing.JTextField()));
(this sets the editor for column 0)

Similar Messages

  • JTable Cell text selection Problem.

    I am using Tab key while navigating with the Cells.While focus reaches into a cell,the cell is selected but not the cell content.So I use BACKSPACE to delete each word of the cell.I want to Select a cell content(i.e. Text) when I am move Tab keys to select cells.Please help me..........,u may send a mail at [email protected]

    Do u need this feature to the whole table or else for the perticular cell in the table?
    Are you using your own renderer or editor to the perticular cell ?,
    this issue is related to Renderer and Editor, so if i know your requirement , then only it is easy to implement.

  • How to listen for cell selection changes within a JTable

    Problem: my table has 8 columns, with 4 of them containing very large text (up to 1000 chars). Solution is to set the initial size these columns so that the 1st 20 chars are visible, and if one of these columns gains focus/selection via mouse-clicking/tabbing/arrow keys, the entire text is shown in a JTextArea below the table.
    I added a ListSelectionListener to the table, but this only informs me when the row selection has changed.
    I added a FocusListener to the table, but this only informs me when the table gains/loses focus, not when it's been changed within.
    I added a TableColumnModelListener to the TableColumnModel, but this only informs me when the column selection has changed.
    I didn't bother with MouseListener as this won't handle change of selection via tabbing.
    The LSL got me half way there, and the TCML got me the other half. Any ideas on how to combine?
    Or is there something obvious that I'm missing?

    Walter Laan wrote:
    Use both and call the same method which updates the text area based on the current selected (or focused == lead selection index) cell.Yeah - that's what I figured. I just didn't know if there was a magic bullet (i.e., a single listener) out there that I was missing.
    While you are at it, also add a table model listener which calls the same method if the selected cell is updated.I'll keep that in mind, but it's not necessary in this particular case. The table cells in question will be uneditable. The text area will have supporting Edit/Save/Cancel buttons.

  • First cell not selected in JTable

    When selecting multiple cells in JTable by pressing the mousebutton and draging the selection over the cells you want to select the first cell is not selected (it stays white).
    Any suggestions on how to fix this?

    I am running in M$ Windows.
    The first cell (anywhere in the Table) when you press the mouse to select a range of cells is present by color white (depend on L&F setting).
    The white color on first cell does not means the first cell is not selected!!!
    ( The first cell is selected, but present by white color to show you that is the start point )
    (if you use M$ Excel, that is the same effect presentation! )
    Hope this helps.

  • Problem in setting focus in JTable

    Hi,
    In my application I am using JTable with a customized table model. The table has two columns. First column has jcombobox as its editor and the second column has the customized editor developed by me. This particular table appears in a wizard. When this wizard page (which contains the above JTable) is shown I set the keyboard focus on the JTable using JTable's requestFocus() method (I even tried with grabFocus()method but got the same result). But the focus does not appear on the JTable. Even none of the cells get the focus. Also no matter how many time I press tab key the focus does not shift to the next component in the page which happens to be a JButton. I have set the next focussable element for the JTable as that JButton. When I manually put the focus on one of the cells by clicking on it and then if I press either arrow key or tab key the focus is lost and it does not go either on the next cell or the JButton.
    If anybody can shed some light on what exactly needs to be done to give proper keyboard navigation for JTable please let me know.
    Regards
    Atul

    Hi Atul,
    I suspect your problem is with your cell renderer. The DefaultTableCellRenderer class has code in the getTableCellRendererComponent method that provides the visual indication as to which cell has the focus. You will want to do something similar in your JPanel-subclassed renderer - perhaps change the border or the background color to indicate whether a cell is selected or not.
    Note also that there is a difference between a cell that has "isSelected" set to true, which indicates that the cell is part of the current selection, and a cell that has "hasFocus" set to true, which indicates that the cell is the last one to be clicked on. Actually, it seems to be a bit more complicated than that, but that's at least part of what "hasFocus" indicates. A cell can be selected and not have the focus, and a cell can have the focus but not be selected. You may want to setup your renderer to clearly indicate which of these states are set and then run your app and play with the table selection to get a feel for how it works.
    Hope that helps.
    - Tyler

  • Drag and Drop of cell content between 2 tables

    Hi Guys,
    Iam into implementing drag and drop of cell contents between 2 different tables,say Table1 and Table2.(Iam not dragging and dropping rows or cells,Just copying the content of one cell to another).
    Have extended the java tutorial class "TableTransferHandler" and "StringTransferHandler" under http://java.sun.com/docs/books/tutorial/uiswing/examples/dnd/index.html#ExtendedDndDemo to satisfy my needs.
    The drag is enabled for Table1 and table2 as follows.
    jTable1.setDragEnabled(true);
    jTable1.setTransferHandler(new TableTransferHandler());
    jTable2.setDragEnabled(true);
    jTable2.setTransferHandler(new TableTransferHandler());
    Dont be taken aback with the code I have put.It just to show what I have done..
    My questions are put at the end of the post..
    //String Transfer Handler class.
    public abstract class StringTransferHandler extends TransferHandler {
        protected abstract String exportString(JComponent c);
        protected abstract void importString(JComponent c, String str);
        protected abstract void cleanup(JComponent c, boolean remove);
        protected Transferable createTransferable(JComponent c) {
            return new StringSelection(exportString(c));
        public int getSourceActions(JComponent c) {
            return COPY_OR_MOVE;
        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;
        protected void exportDone(JComponent c, Transferable data, int action) {
            cleanup(c, action == MOVE);
        public boolean canImport(JComponent c, DataFlavor[] flavors) {
              JTable table = (JTable)c;         
             int selColIndex = table.getSelectedColumn();
            for (int i = 0; i < flavors.length; i++) {
                if ((DataFlavor.stringFlavor.equals(flavors))&& (selColIndex !=0)) {
    return true;
    return false;
    }//TableTransferHandler classpublic class TableTransferHandler extends StringTransferHandler {
    private int[] rows = null;
    private int addIndex = -1; //Location where items were added
    private int addCount = 0; //Number of items added.
    protected String exportString(JComponent c) {
    JTable table = (JTable)c;
    rows = table.getSelectedRows();
    StringBuffer buff = new StringBuffer();
    int selRowIndex = table.getSelectedRow();
    int selColIndex = table.getSelectedColumn();
    String val = table.getValueAt(selRowIndex,selColIndex).toString();
    buff.append(val);
    return buff.toString();
    protected void importString(JComponent c, String str) {
    JTable target = (JTable)c;
    DefaultTableModel model = (DefaultTableModel)target.getModel();
    //int index = target.getSelectedRow();
    int row = target.getSelectedRow();
    int column = target.getSelectedColumn();
    target.setValueAt(str, row, column);
    protected void cleanup(JComponent c, boolean remove) {
    }Now I want to put in the following functionality into my program...
    [1]prevent dragging and dropping text in to the same table.That means I dont want to drag a cell content from Table1  and drop to another cell in Table1. Want to drag and drop cell content only from Table1 to Table2.
    [2]Change cursor on a un-defined Target. That means how to prevent a drag from a particular column in Table1.Also how to prevent a drop to a particular column in Table2. How to change the cursor to a "NO-DRAG" cursoror "NO-DROP" cursor.
    Could it be done using Drag Source Listener and drop Target Listener?.
    If yes,How can these listeners attached to the table and how to do it?
    If No,How Could it be done?
    [3]Want to change the background colour of the cell being dragged and also the background colour of the target cell where the drop is made...
    [4]Is there any out of the box way to make an undo in the target cell(where drop was made) so that the old cell value is brought back.
    How can I extend my code to take care of the above said things.
    Any help or suggestions is greatly appreciated.....
    Edited by: Kohinoor on Jan 17, 2008 10:58 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi Guys,
    Iam into implementing drag and drop of cell contents between 2 different tables,say Table1 and Table2.(Iam not dragging and dropping rows or cells,Just copying the content of one cell to another).
    Have extended the java tutorial class "TableTransferHandler" and "StringTransferHandler" under http://java.sun.com/docs/books/tutorial/uiswing/examples/dnd/index.html#ExtendedDndDemo to satisfy my needs.
    The drag is enabled for Table1 and table2 as follows.
    jTable1.setDragEnabled(true);
    jTable1.setTransferHandler(new TableTransferHandler());
    jTable2.setDragEnabled(true);
    jTable2.setTransferHandler(new TableTransferHandler());
    Dont be taken aback with the code I have put.It just to show what I have done..
    My questions are put at the end of the post..
    //String Transfer Handler class.
    public abstract class StringTransferHandler extends TransferHandler {
        protected abstract String exportString(JComponent c);
        protected abstract void importString(JComponent c, String str);
        protected abstract void cleanup(JComponent c, boolean remove);
        protected Transferable createTransferable(JComponent c) {
            return new StringSelection(exportString(c));
        public int getSourceActions(JComponent c) {
            return COPY_OR_MOVE;
        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;
        protected void exportDone(JComponent c, Transferable data, int action) {
            cleanup(c, action == MOVE);
        public boolean canImport(JComponent c, DataFlavor[] flavors) {
              JTable table = (JTable)c;         
             int selColIndex = table.getSelectedColumn();
            for (int i = 0; i < flavors.length; i++) {
                if ((DataFlavor.stringFlavor.equals(flavors))&& (selColIndex !=0)) {
    return true;
    return false;
    }//TableTransferHandler classpublic class TableTransferHandler extends StringTransferHandler {
    private int[] rows = null;
    private int addIndex = -1; //Location where items were added
    private int addCount = 0; //Number of items added.
    protected String exportString(JComponent c) {
    JTable table = (JTable)c;
    rows = table.getSelectedRows();
    StringBuffer buff = new StringBuffer();
    int selRowIndex = table.getSelectedRow();
    int selColIndex = table.getSelectedColumn();
    String val = table.getValueAt(selRowIndex,selColIndex).toString();
    buff.append(val);
    return buff.toString();
    protected void importString(JComponent c, String str) {
    JTable target = (JTable)c;
    DefaultTableModel model = (DefaultTableModel)target.getModel();
    //int index = target.getSelectedRow();
    int row = target.getSelectedRow();
    int column = target.getSelectedColumn();
    target.setValueAt(str, row, column);
    protected void cleanup(JComponent c, boolean remove) {
    }Now I want to put in the following functionality into my program...
    [1]prevent dragging and dropping text in to the same table.That means I dont want to drag a cell content from Table1  and drop to another cell in Table1. Want to drag and drop cell content only from Table1 to Table2.
    [2]Change cursor on a un-defined Target. That means how to prevent a drag from a particular column in Table1.Also how to prevent a drop to a particular column in Table2. How to change the cursor to a "NO-DRAG" cursoror "NO-DROP" cursor.
    Could it be done using Drag Source Listener and drop Target Listener?.
    If yes,How can these listeners attached to the table and how to do it?
    If No,How Could it be done?
    [3]Want to change the background colour of the cell being dragged and also the background colour of the target cell where the drop is made...
    [4]Is there any out of the box way to make an undo in the target cell(where drop was made) so that the old cell value is brought back.
    How can I extend my code to take care of the above said things.
    Any help or suggestions is greatly appreciated.....
    Edited by: Kohinoor on Jan 17, 2008 10:58 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • To change the font of a selected row in a Jtable

    Hello,
    Is it possible to change the font of a selected row in a jtable?
    i.e. if all the table is set to a bold font, how would you change the font of the row selected to a normal (not bold) font?
    thank you.

    String will be left justified
    Integer will be right justified
    Date will be a simple date without the time.
    As it will with this renderer.Only if your custom renderer duplicates the code
    found in each of the above renderers. This is a waste
    of time to duplicate code. The idea is to reuse code
    not duplicate and debug again.
    No, no, no there will be NO duplicated code.
    A single renderer class can handle all types ofdata.
    Sure you can fit a square peg into a round hole if
    you work hard enough. Why does the JDK come with
    separate renderers for Date, Integer, Double, Icon,
    Boolean? So that, by default the rendering for common classes is done correctly.
    Because its a better design then having code
    with a bunch of "instanceof" checks and nested
    if...else code.This is only required for customization BEYOND what the default renderers provide
    >
    And you would only have to use instanceof checkswhen you required custom
    rendering for a particular classAgreed, but as soon as you do require custom
    renderering you need to customize your renderer.
    which you would also have to do with theprepareRenderer calls too
    Not true. The code is the same whether you treat
    every cell as a String or whether you use a custom
    renderer for every cell. Here is the code to make the
    text of the selected line(s) bold:
    public Component prepareRenderer(TableCellRenderer
    renderer, int row, int column)
    Component c = super.prepareRenderer(renderer, row,
    , column);
         if (isRowSelected(row))
              c.setFont( c.getFont().deriveFont(Font.BOLD) );
         return c;
    }It will work for any renderer used by the table since
    the prepareRenderer(...) method returns a Component.
    There is no need to do any kind of "instanceof"
    checking. It doesn't matter whether the cell is
    renderered with the "Object" renderer or the
    "Integer" renderer.
    If the user wants to treat all columns as Strings or
    treat individual columns as String, Integer, Data...,
    then they only need to override the getColumnClass()
    method. There is no change to the prepareRenderer()
    code.
    Have you actually tried the code to see how simple it
    is?
    I've posted my code. Why don't you post your solution
    that will allow the user to bold the text of a Date,
    Integer, and String data in separate column and then
    let the poster decide.Well, I don't see a compilable, runnable demo anywhere in this thread. So here's one
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    import java.util.Arrays;
    import java.util.Date;
    import java.util.Vector;
    public class TableRendererDemo extends JFrame{
        String[] headers = {"String","Integer","Float","Boolean","Date"};
        private JTable table;
        public TableRendererDemo() {
            buildGUI();
        private void buildGUI() {
            JPanel mainPanel = (JPanel) getContentPane();
            mainPanel.setLayout(new BorderLayout());
            Vector headerVector = new Vector(Arrays.asList(headers));
             Vector data = createDataVector();
            DefaultTableModel tableModel = new DefaultTableModel(data, headerVector){
                public Class getColumnClass(int columnIndex) {
                    return getValueAt(0,columnIndex).getClass();
            table = new JTable(tableModel);
    //        table.setDefaultRenderer(Object.class, new MyTableCellRenderer());
            table.setDefaultRenderer(String.class, new MyTableCellRenderer());
            table.setDefaultRenderer(Integer.class, new MyTableCellRenderer());
            table.setDefaultRenderer(Float.class, new MyTableCellRenderer());
            table.setDefaultRenderer(Date.class, new MyTableCellRenderer());
            JScrollPane jsp = new JScrollPane(table);
            mainPanel.add(jsp, BorderLayout.CENTER);
            pack();
            setLocationRelativeTo(null);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        private Vector createDataVector(){
            Vector dataVector = new Vector();
            for ( int i = 0 ; i < 10; i++){
                Vector rowVector = new Vector();
                rowVector.add(new String("String "+i));
                rowVector.add(new Integer(i));
                rowVector.add(new Float(1.23));
                rowVector.add( (i % 2 == 0 ? Boolean.TRUE : Boolean.FALSE));
                rowVector.add(new Date());
                dataVector.add(rowVector);
            return dataVector;
        public static void main(String[] args) {
            Runnable runnable = new Runnable() {
                public void run() {
                    TableRendererDemo tableRendererDemo = new TableRendererDemo();
                    tableRendererDemo.setVisible(true);
            SwingUtilities.invokeLater(runnable);
        class MyTableCellRenderer extends DefaultTableCellRenderer{
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                 super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                if ( isSelected){
                    setFont(getFont().deriveFont(Font.BOLD));
                else{
                    setFont(getFont().deriveFont(Font.PLAIN));
                if ( value instanceof Date){
                    SimpleDateFormat formatter =(SimpleDateFormat) SimpleDateFormat.getDateInstance(DateFormat.MEDIUM);
                    setText(formatter.format((Date)value));
                if(value instanceof Number){
                   setText(((Number)value).toString());
                return this;
    }Hardly a "bunch of instanceof or nested loops. I only used the Date instanceof to allow date format to be specified/ modified. If it was left out the Date column would be "18 Apr 2005" ( DateFormat.MEDIUM, which is default).
    Cheers
    DB

  • Customizing the Cell Content of a Pivot Table

    Hi,
    I have been away from ADF for a few years (since 10g v 1.3.1) and am quite impressed with all the Faces functionality added to the 11g release. The application I wrote relied heavily on pivot tables which back then, I had to use stored procedures in the database and dynamically views to display information. I am very interested in moving this application to 11g and taking advantage of the PivotTable component. One thing the application does is change the style of cells based upon the object being presented. I have been reading:
    Oracle® Fusion Middleware
    Web User Interface Developer's Guide for Oracle Application
    Development Framework
    11g Release 1 (11.1.1)
    B31973-03
    And am very interested in section 26.8 Customizing the Cell Content of a Pivot Table.
    I easily created a pivot table and would like to change the formatting of various cells. I created a backing bean for a test page and added the Example 26–4 Sample Code to Change Style and Text Style in a Pivot Table to the bean.
    public CellFormat getDataFormat(DataCellContext cxt)
    CellFormat cellFormat = new CellFormat(null, null, null);
    QDR qdr = cxt.getQDR();
    //Obtain a reference to the product category column.
    Object productCateg = qdr.getDimMember("ProductCategory");
    //Obtain a reference to the product column.
    Object product = qdr.getDimMember("ProductId");
    if (productCateg != null && productCateg.toString().equals("Sales Total"))
    cellFormat.setTextStyle("font-weight:bold")
    cellFormat.setStyle("background-color:#C0C0C0");
    else if (product != null && product.toString().equals("Sales Total")
    cellFormat.setTextStyle("font-weight:bold");
    cellFormat.setStyle("background-color:#C0C0C0");
    return cellFormat;
    Almost verbatim except changed the literals to select data in my use case domain. My question is: How do I invoke this message from my pivot table? I need to pass it a instance of the DataCellContext. The example is great and illustrates what I am looking to do but does not go into the implementation details required. Is there a sample app available for download that demonstrates these capabilities?
    Thanks,
    Jeff
    Edited by: jcapzz on Jun 9, 2011 3:56 PM

    Hello,
    I haven't fully understood your question.
    Is it: How do I call the getDataFormat() method from my pivot table?
    If so , you need to set the dataFormat attribute of your pivot table.
    ex: <dvt:pivotTable id="pt2" var="cellData" varStatus="cellStatus"
    value="#{bindings.YourView.pivotTableModel}"
    headerFormat="#{viewScope.yourBean.getHeaderFormat}"
    *dataFormat="#{viewScope.yourBean.getDataFormat}"*
    contentDelivery="immediate" pivotEnabled="false"
    columnFetchSize="-1" rowFetchSize="-1"
    />
    I also put the *headerFormat* attribute which allows to customize the headers
    I hope I understood your question ;)
    Jack

  • Copy cell content in OBIEE 11g

    I am unable to copy the cell content from OBI dashboard.
    Is this OBIEE 11g bug? I am using OBIEE 11.1.1.6.0
    Any way to resolve this ??
    Thanks in Advance !!

    Hi,
    This workaround may not be the best but might serve the purpose.
    I selected a cell and created a group for the value. Then I selected that group and viewed it's definition. This showed me a single value (which I wanted to copy). I copied the value and pasted to another application.
    This worked in analysis as well as on dashboard. I could create a group of more than one cell and copy all the values of that new group to paste to another application.
    I then deleted the groups. While using dashboard, I simply clicked 'Back' or 'Return' to remove the groups automatically.
    Manoj.

  • NaN on the run (add cell contents) [CS3, JS]

    Hello.
    This is my first attempt at javascripting ID, though I've done some amount of Applescripting.
    The intent of this script is to add the contents of the table cells that a user has selected.
    I can't figure out why this keeps returning 'NaN' (not a number) after I have told it to ignore any 'NaN' contents (and exclude them from the running total).
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    var theTotal=0;
    //If the selection is at least one table cell...
    if (app.selection[0].constructor.name == "Cell")
    //count cells in selection
    var cellCount=(app.selection[0].cells.count(0));
    //repeat with count from 1 to count of cells
    for (a=0; a<=cellCount; a++)
    //get contents of first selected cell in the loop
    cellVal=(app.selection[0].contents[a]);
    //convert string to # via parseFloat command
    cellValInteger=parseFloat(cellVal);
    if (cellValInteger!="NaN") //NaN = not a number
    //set the variable to the sum of each cell value
    theTotal+=cellValInteger;}
    else{
    alert("Please fully select at least one table cell and try again.");

    Bob and Dave, many thanks for your help. It works now, and my next challenge is to figure out how to put that data into the last cell.
    Aaron

  • Cell content never change in "calendar" in Numbers

    I am tracking intraday profit in Numbers, I am using the template “calendar”. Problem is cell content stays the same in each month. What formula to use?

    When you change the pop-up you are only changing the month the table shows.  If does NOT store what you enter in a special place for each month.
    I think you would find it easier to simply enter the daily information into a list which is summarized in a single table like this:
    Make two tables:
    1) called "Information" as shown on the left, above
    2) called "Summary" as shown on the right, above
    For the table on the left, titled "Information":
    make the first two rows a header using the Table formatter:
    And set up as show in the first image I posted.
    Now expand the size of the table by selecting column A (click the letter "A" at the very top of the table) and add addiitional rows by holding the command and option keys which pressing the down arrow until there are at least 365 rows.
    A3=DATE($B$1,1,1)+DURATION(0,1)×ROW()−3
    this is shorthand for... select cell A3, then type, or copy and paste from here, the formula:
    =DATE($B$1,1,1)+DURATION(0,1)×ROW()−3
    type the enter key.  Now select cell A3, again, copy
    now select  column A by click the letter "A" at the very top of the column.  now hold the command key and click cell A1, and A2 to unselect them.
    paste
    you will enter the daily amounts in column B.
    Now let's create the summary table.  Add a new table and size as show on the right in the first image of this post.  Make the first row a header.
    in cell A2 type "January" without the double quote
    now fill this down to enter the months by hovering the cursor over the bottom edge of the cell and dragging the yelow circle down
    B2=SUMIFS(Information::B,Information::A,">="&DATE(Information::$B$1, ROW()−1, 1), Information::A, "<="&EOMONTH(DATE(Information::$B$1, ROW()−1, 1),0))
    this, again, is shorthand for select cell B2, then type (or copy and paste from here) the formula:
    =SUMIFS(Information::B,Information::A,">="&DATE(Information::$B$1, ROW()−1, 1), Information::A, "<="&EOMONTH(DATE(Information::$B$1, ROW()−1, 1),0))
    now select cell B2, then copy
    select column B, then unselect cell B1 (by command  + click), then paste

  • Expanding/Enhancing a table cell contents

    I have a search utility that shows my database query results in a read-only table.
    Say this table T has columns C1-C5 and rows R1-R5.
    Data returned in column C3 has a VARCHAR count between 2000-4000.
    Currently the table only displays somewhere in the region of 500 characters (on mouse hover) for this column, the page depends how far you can stretch the table column.
    My question is three part:
    - is there an ADF component that will allow me to copy the contents of a cell, for example, column C3 row R1.
    - is there an ADF component that will allow me to expand the cell(C3/R1) in a popup window? (And enable other cells in the C3 column to do the same)
    - is there an ADF component that will allow me to open the cell contents in a new window? or .txt (And enable other cells in the C3 column to do the same)
    Jdev Version (11.1.2.4)

    User, which jdev version do you use?
    All this can be done.
    1) Yes, but this depends on the use case (e.g. per drag & drop or copy & paste using the keyboard)
    2) Yes a popup which you e.g. show on hoover which shows all text or you click on the cell and open a popup
    3) Yes, if your table is in click to edit mode or you show a form with all attributes of the selected row in a new window (which allows you to layout the components better).
    Timo

  • Modifying the cell content based on input parameter from variable screen.

    I am trying to modify a cell content in the BEX Web Application Report based on the input parameter from the variable screen.
    I am already aware of how to change the cell content by creating a new ABAP class and inheriting CL_RSR_WWW_MODIFY_TABLE.
    I do not know how to get the input parameter variable from the variable screen in my custom class ZCL_RSR_WWW_MODIFY_TABLE. I am not very familiar with ABAP and would appreciate your help.
    Thanks
    Sowmini

    in the start method
    define a work area like line of n_r_data_set->N_SX_VERSION_20A_1-TXT_SYMBOLS
    loop at n_r_data_set->N_SX_VERSION_20A_1-TXT_SYMBOLS into <wa> ..
    endloop .
    This will have all the filter, variable values entered in the selection.
    Regards
    Raja

  • Table Cell Contents Disappears Please HELP!!!!

    PROBLEM: I have a different tables within different table cells in the Master table. One table per Master cell. Once I click on a table cell (0,0) and click on another table cell (1,1) the cell (0,0) blanks out. Likewise with other cells so that if I've click on all the cells in the Master Table and then clicked somewhere else all cell contents have disappeared.
    QUESTION: Do I need to call some UI refresh procedure????? I have a cell renderer which returns the table for each Master's Cell.
    I don't if this is clear but please help!
    Thanks

    Hi,
    the problem is that the DefaultCellEditor can't handle tables.
    So you have to write your CellEditor, which returns another table as Editor.
    class YourTableCellRenderer implements  TableCellRenderer{
        private  JTable table = new JTable();
        public Component getTableCellRendererComponent(JTable table,
                                                       Object value,
                                                       boolean isSelected,
                                                       boolean hasFocus,
                                                       int row,
                                                       int column){
             // set Data and Layout
             return table;
    }then set the Editor to your MasterTable (master) with.
    master.setCellEditor(TableCellEditor anEditor) or
    master.setDefaultEditor(Class columnClass,
                                 TableCellEditor editor);Hope this Helps.
    Michael

  • Is it possible to use wildcards to match cell contents in an if statement?

    I need to return a ID along with some other information on a page by page basis, so that the information comes out linked by position.  I use a couple of loops and if statements to navigate through the document.  I am able to use exact matches of cell contents which is fine when the contents doesn't vary.  But the IDs, though they have a similar pattern, are all different. In a menu driven search, I am able to find what I need with '150^9^9^9^9^9-^9^9^9' But when I try putting this (or any number of [0-9], *, ? combinations) it fails.  Is it possible to use wildcards?  The symbol used for the match (==) makes me suspect that it is not possible and that only literal, exact matches will work.  But I wanted to check with the experts before giving up.
    Thanks
    pcbaz

    Thanks for the input.  You're right, a GREP search is much more efficient.  But what I'm trying to do and the circumstances here don't allow me, I think,  to go that route. I am trying to generate a list of values coming from several textframes on a single page and have them come out so that I can tell which values belong together.
    I'm using an inherited document with masters that were created 'manually';  the index numbering for textframes and tables is random. I navigate through the pages, looping through textframe indices asking ' does this textframe exist?' If so, I ask if it is a table -- if no, it is a simple textframe and I ask about the ID, if yes, I ask if the contents of cell (0,0) (invariant position and contents) are equal to the table I want..  I am sending the ID and other pieces of information from the table to one row of a new table on a new page.  So the ID and other information from a single page are linked by being in the same row.
    I know this a little 'off-normal' -- I'm using the search to navigate through the document and find things by location the way you do with a spreadsheet.  I have devised a work-around that helps me get around the fact that the ID is not invariant.  I create a list of the (exact) IDs from another document, equating them to a variable ('a').  I then loop through the list of IDs and ask if the contents of the textframe is equal to 'a'..This works o.k, unless there happens to be an extra space, a different kind of hyphen, etc. It would be so much easier if I could use the wildcards that work in a menu-driven text or GREP search in script just to ask about the contents of the textframe.
    Thanks again
    pcbaz (Peter BIerly)
    P.S. we have since rewritten the masters so this problem will not exist in the future -- we now know exactly which textframe and/or table indices to refer to to get any particular bits of information and don't need to ask questions about the contents.

Maybe you are looking for

  • Cross company code validation in CO Area

    Dear All Experts, I am having one query regarding cross company code validation in CO area. I have ticked Cross company code validation in controlling area, and it is working perfect. we have total 11 company codes. 10 for US & 1 for Canada. Say 1001

  • My project was not saved and is now gone...where did it go?

    Help My project was not saved and is now gone...where did it go?

  • BO Edge 3.1 Update - From 3.1A to SP3

    Hi everyone, We performed an install of BO Edge 3.1 SP3 on 3.1A. The installation seems to have completed OK however the web applications do not seem to have updated correctly. From About the version still shows 12.1 which is very weiird. We are usin

  • Weblogic & webcache clustering

    Hi Guru, We have 2 node 11gR2 RAC, 2 application server & load balancing H/W (Brocade). Each node of appserver installed weblogic 10.3.5 & webcache 11.1.1.5. I'm planning to install weblogic domain clustering on both appserver (appserver 1 : admin se

  • Shut downs

    Hi, I posted this in the power g5 section. Anyways, My iMac shuts down by itself. The shutdowns are now more frequent. I was listening to a song on iTunes and it shutdown. Any comments or suggestions? Regards, BC iMac G5   Mac OS X (10.4.8)