PLEASE HELP-JTable cell editor-change one cell, changes all cells of column

for example i have 3 rows 4 columns, column 3 and 4 are dates. now if i change the date to a new value (eg for of column 3)
for any row, and then i click on any other cell. All cell values ie all rows for that column are changed to that new value.
ie it changed column 3 for all rows 1, 2 and 3 to that new value which i changed in only one cell of that column.
PLEASE HELP me , tell me what change i make to the code to fix it ....
this is my cell renderer for date
class DateCellRenderer extends JbcDateTimeChooser implements TableCellRenderer {
  protected Border m_noFocusBorder;
  public DateCellRenderer() {
    super();
    setStylePattern(JbcDateTimeChooser.MEDIUM);
    m_noFocusBorder = new EmptyBorder(1, 2, 1, 2);
    setOpaque(true);
    setBorder(m_noFocusBorder);
  public Component getTableCellRendererComponent(JTable table,
   Object value, boolean isSelected, boolean hasFocus,
   int row, int column)
  if(value instanceof Date) {
      Date b = (Date)value;
      setDate(b);
    setFont(table.getFont());
    setBorder(hasFocus ? UIManager.getBorder(
      "Table.focusCellHighlightBorder") : m_noFocusBorder);
    return this;
}I have this custom cell editor date
class DateCellEditor extends AbstractCellEditor implements TableCellEditor {
  protected JbcDateTimeChooser editor;
  public DateCellEditor() {
    super();
    editor = new JbcDateTimeChooser();
    editor.setStylePattern(JbcDateTimeChooser.MEDIUM);
  public Object getCellEditorValue() {
    return editor.getDate();
  public Component getTableCellEditorComponent(JTable table,
   Object value, boolean isSelected, int row, int column)
    if(value instanceof Date) {
      editor.setDate((Date)value);
    return editor;
}and this is how i defined in jtable
    lnnTableModel = new CellSiteLNNTableModel();
    lnnTable.setModel(lnnTableModel);
    lnnTableModel.addColumn("ABC");
    lnnTableModel.addColumn("DEF");
    lnnTableModel.addColumn("Date From");
    lnnTableModel.addColumn("Date To");
    for(int k = 0; k < lnnTableModel.getColumnCount(); k++) {
      TableColumn col = lnnTable.getColumn(lnnTableModel.getColumnName(k));
      TableCellRenderer renderer;
        DefaultTableCellRenderer textRenderer = new DefaultTableCellRenderer();
        renderer = textRenderer;
      TableCellEditor editor;
      JTextField textColumn = new JTextField();
      if((k == CellSiteLNN.DATE_FROM) || (k == CellSiteLNN.DATE_TO)) {
        editor = new DateCellEditor();  //  this is the cell editor
     renderer = new DateCellRenderer(); // this is the assigned cell renderer
      } else {
        editor = new DefaultCellEditor(textColumn);
      col.setCellRenderer(renderer);
      col.setCellEditor(editor);
    }

table model is extended from AbstractTableModel
and have these methods
do you see anything wrong here.....
  public Object getValueAt(int row, int column) {
    Vector rowVector = (Vector)dataVector.elementAt(row);
    return rowVector.elementAt(column);
  public void setValueAt(Object aValue, int row, int column) {
    Vector rowVector = (Vector)dataVector.elementAt(row);
    rowVector.setElementAt(aValue, column);
    // generate notification
    fireTableChanged(new TableModelEvent(this, row, row, column));
  } // end method (setValueAt)

Similar Messages

  • I added a contact to my iphone 4s and when I did a sync manually it is not showing up on my MAC in address book - please help....I checked off sync all contacts in iTunes  - does it only work one way from computer to phone?

    I added a contact to my iphone 4s and when I did a sync manually it is not showing up on my MAC in address book - please help....I checked off sync all contacts in iTunes  - does it only work one way from computer to phone?

    Is it because the new itunes looks different.
    View > Show Sidebar
    Then it should work just the same as on your old computer.

  • I have problem with previous billing purchase,now i cant change my credit card because my previous credit card was closed,and there in none selection between the visa mastercard and amex,please help i want to to purchase,and change credit card

    please help me i already input another card and the securitycodes but the device said for assistance,contact iTunes Support at www.apple.com/support/itunes/ww/.
    it doesnt help at all please help me
    i want to purchase and change credit card

    This is a user-supported forum. You are talking to other users here, not Apple. As the advice suggested, contact iTunes Customer Support at: http://www.apple.com/support/itunes/contact/

  • I have lost my new iPhone. Please help. I have the IMEI no and all the details that comes at the back of the box.

    I have lost my new iPhone. Please help. I have the IMEI no and all the details that comes at the back of the box.

    Having the imei won't help you find your phone.
    If you setup and enabled find my phone prior to losing it then go to icloud.com
    If you didn't set it up - then there nothing you can do.
    Call your carrier and let them know, change all your passwords.

  • My ipod 7th generation is not recognised by itunes and my computer. I am not able to transfer any songs. Please help me on this regard. I tried all the steps from apple website

    my ipod 7th generation is not recognised by itunes and my computer. I am not able to transfer any songs. Please help me on this regard. I tried all the steps from apple website

    This article should give you the options
    https://discussions.apple.com/docs/DOC-3991

  • When I plug my iPod into the computer, itunes won't come up on the screen and my iPod is not recognized anymore and it use to be. Please help because I can't sync it at all because it won't show up as a device

    When I plug my iPod into the computer, itunes won't come up on the screen and my iPod is not recognized anymore and it use to be. Please help because I can't sync it at all because it won't show up as a device on the right hand side of itunes.

    Try
    iOS: Device not recognized in iTunes for Windows
    I would start with              
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    or              
    Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8
    Before you reinstall the Apple software, also remove iCloud vi Control Panel Remove programs. The reinstall the Apple programs
    New cable and different USB port?
    Runs this and see if the results help with determine the cause
    iTunes for Windows: Device Sync Tests
    Try on another computer to help determine if computer or iPod problem

  • Emergency! Please Help. I have an iPhone 4 with all my pictures from the vacation on it and I plugged into my computer and it sync'ed to my ipod.  all of my pictures are gone.  How do I get my pictures back?

    Emergency! Please Help. I have an iPhone 4 with all my pictures from the vacation on it and I plugged into my computer and it sync'ed to my ipod.  all of my pictures are gone.  How do I get my pictures back?

    If all you did was sync your phone, and if you haven't synced again since this happened, you can restore your phone from the backup that was created at the beginning of the sync process (camera roll photos are included in the backup).  If you have synced again since this happened this backup has already been overwritten and your photos are lost.  Also, if you restored your phone from the backup of your iPod, rather than just synced, then your  photos are lost too.
    If you have an intact backup that contains these photos, do the following:
    Without connecting your phone, open iTunes on your computer and go to Preferences.  On the Devices tab check "Prevent...from syncing automatically".
    Connect your phone to your computer, right-click on the name of your phone when it appears in iTunes on the left sidebar and select Restore from Backup, choose your most recent backup to restore from.
    When complete, you can go back to iTunes>Preferences>Devices and re-enable automatic syncing.

  • Can someone please help? my address bar is missing. All i have in its place is a grayed out tab that will not allow me enter a URL.

    can someone please help? my address bar is missing. All i have in its place is a grayed out tab that will not allow me enter a URL.

    What browser?
    Is this a Mac Pro?

  • Please Help.JTable insert styled text

    Hi all java guru,
    on post http://forum.java.sun.com/thread.jsp?forum=57&thread=485469 i've depicted my scenario in which i have a JTable where i want to add styled text.
    i've implemented a CustomTableModel that maintains information about text style, in such way that when renderer cell, i can rebuild exact text with its style....same method is adopted for CellEditor.
    It is possible to have more than one JTable in my application....then to correctly handle all JTables ' put them in a vector and during editing and rendering i find current focusable/selected JTable and edit/render it.
    Clearly i maintain information about style of text when i insert it, that is when i insert text, i update my CustomTableModel...same thing must be done when i delete text from JTable...that is, i must update CustomTableModel too in this case.
    Because my CellEditor is a JEditorPane component (extend it) i've registered document associated to it to a DocumentListener that notify every time that a remove operation is happens.
    What is the problem now???problem is that when i finish to edit a cell and click on another cell i've got a removeUpdate(DocumenEvent e) event, and i can't distinguish it.....it seems a real remove event....
    In this case(when i change cell) the code that is executes returns wrong result and invalidate all the rest.
    I think error is where i register celleditor , now i do it in CustomCellRenderer class that extend JEditorPane and implements TableCellRenderer.
    Please help me...this is a great trouble that invalidate all my work :(
    Any new idea is welcome.
    regards,
    anti-shock

    Hi stanislav, of course i can...you're a myth :)
    public class CustomCellEditor extends AbstractCellEditor implements TableCellEditor {
           CellEditor cellArea;
         JTable table;
         public CustomCellEditor(JTable ta) {
              super();
              table = ta;
              // this component relies on having this renderer for the String class
              MultiLineCellRenderer renderer = new MultiLineCellRenderer();
              table.setDefaultRenderer(String.class,renderer);
         public Object getCellEditorValue() {
              return cellArea.getText();
         public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected,     int row, int column) {
              int start = 0;
              int end = 0;
                                               // Get current selected table
              TableEditor tb = (TableEditor) TableEditor.getSelectedTable();
              TableModel model = (TableModel) tb.getModel();
              Vector fontInfo = model.getFontFor(row,column);
              CellEditor cellArea = (CellEditor) ((CustomCellEditor)tb.getCellEditor (row,column)).getCellEditor();
              Document doc = cellArea.getDocument();
              String content = tb.getValueAt(row,column).toString();     
              if (doc!=null && fontInfo.size()>0 && !content.equals("")) {
                                                     // This method reads from model and get right style info
                                                     // for current text, and restore them
                                                     restoreFontWithAttributes(doc,fontInfo,content);
              else
                   cellArea.setText(tb.getValueAt(row,column).toString());
              cellArea.rowEditing = row;
              cellArea.columnEditing = column;
              cellArea.lastPreferredHeight = cellArea.getPreferredSize().height;
              return cellArea;
          * @return
         public CellEditor getCellEditor() {
              return cellArea;
         public class CellEditor extends JEditorPane {
              private CellStyledEditorKit k;
              public CellEditor() {
                    super("text/plain","");
                    k = new CellStyledEditorKit();
                    setEditorKit(k);
                    // I tried to add document here, but i have had wrong behavior
                   doc = new DocumentListener() {
                   public void removeUpdate(DocumentEvent e) {
                      // Get current selected table
                      TableEditor tb = (TableEditor) TableEditor.getSelectedTable();
                      TableModel model = (TableModel) tb.getModel();
                      model.updateFontInfo();
                   getDocument().addDocumentListener(doc);
    }Ok, stan...this is my CustomCellRenderer class....as i have already said, i have some style text info mainteined by CustomTableModel associated with JTable.
    I update CustomTableModel every time that an insert and remove operation happens.
    If i add a DocumentListener to CellEditor (that rapresents editor cell of my table) happens that, if i remove some character from an editing cell, i got a removeUpdate event.....and this is right!!! But if i change cell (e.g. supposing editing cell(1,1), click on cell(2,1) then stop edit cell(1,1) and start edit cell(2,1)) i got a removeUpdate event, that I don't wait for to me..
    Look at this:
    empty cell | some text
    cell 0 ------- cell1
    supposing you're in cell1 and you have finished to insert "some text".Then click on cell0, that is empty....then document associated with CellArea(extend JEditorPane) before of the click on cell0 had some text, but after click have no text, then for it a removeUpdate is happens.....and is that one i got..
    it's as if an unique document is associated to all cells, while should be one document for each cell (i hope this is right).
    Clearly, i've same code for renderer, in such way that i can restore style of text on rendering.
    Hope is clear....if U have any idea or suggestion please give to me.
    Tnx a lot Stanislav..
    regards,
    anti-shock

  • Please help!  I am not iTunes knowledgeable at all.  After entering an iTunes gift card code I can see $20.00 at the top of my screen.  How do I use that to pay for something?

    Please help me (for my daughter's sake) figure out how to spend the $20.00 we can see sitting at the top of our iTunes Store page.  We are trying to buy a movie that is $19.99 but it keeps telling us there are not sufficient funds to pay for it.  Is tax charged to buy and download a movie?
    Thanks!

    Make sure that you allow pages to choose their colors and that you haven't enabled High Contrast in the Accessibility settings.
    *Firefox > Preferences > Content : Fonts & Colors > Colors : [X] "Allow pages to choose their own colors, instead of my selections above"
    See also:
    *http://kb.mozillazine.org/Images_or_animations_do_not_load
    *https://support.mozilla.org/kb/Images+or+animations+do+not+show

  • Please Help! click wheel doesn't respond at all!

    I was running with my brand stinking new ipod 60 gb color and then when i tried to use the clickwheel, it did not respond at all. The play and menu and all the other buttons including select won't work and i can't scroll using the clickwheel. I'm in Israel for the year, so I'm hoping I don't have to ship it to USA and then to APPLE cuz that can take months... so hopefully someone knows the solution. Please help. Im extremely distressed

    I see that you are from Austin. My wife and I just moved from there 2 1/2 months ago... we sure miss Texas. I didn't think that I would be so attached. I am a Longhorn and really miss driving downtown and see the orange tower after a Longhorn victory.

  • Please Help: Attempted install of new IOS 7 for iPhone - cell then requested to be plugged into iTunes - told it was in recovery mode - tried to restore - got error 4013

    After attempting to install the new update, my iPhone is requesting to be pugged into iTunes. On the screen is a picture of iTunes and a cord. When I plug it into my MacBook air it will no recognzie it - though it did so in the past. I attempted a number, if not all, suggested I could find posted but nohting worked. As per one reconmondation, I have attempted to plug it into my PC (Which I don't use often - so I had to do all the updates). My PC recognized the phone and said that my phone was in recovery mode. So, I allowed iTunes to do its thing - iTunes said it was installing updates and recovering the phone (which took about an hour). When it was done, iTunes informed me that the phone needed recovery. So, I clicked recovery. It went through its thing then popped up with an error message 4013. When I requestion further information (button on the bottom), it opens a blank workd document (not really sure what that is about). After the error message, I reset the compuer and plugged it back in. Clicked the restore button but I received the same error message again.
    I have also tried to plug it back into my Mac but still no luck.
    On both my Mac and PC I have
    - Done all the update to both software and iTunes,
    - Reset the computer (multiple times)
    - reset the phone - but the picure of iTunes and cord remains
    - tried different cords
    - disabled my security settings
    - tried different USB ports
    I am at a loss. This is my only phone so I am unable to call apple support. Plus I live in a small town, so there are no apple aproved stores near by.
    Thank you in advance for your help

    Spent hours trying everything suggested and finally this morning hit on a solution. iTunes must be run as an administrator. Even though you are logged into your PC as an administrator, using the iTunes shortcut does not make you an administrator in iTunes. I found this out by using the diagnostics in iTunes and reading through the results report.
    I am using Windows 7, so I clicked the start button and right clicked on iTunes and selected "Run as an adimistrator". The first restore attempt got the 4013 error. I then did the DFU thing, hold power and home buttons for 10 seconds, release power and continue holding home for 10 more seconds.
    iTunes gave me the restore message and I clicked it. I clicked the restore iPhone button and it started. The drivers loaded a couple of times. I got the apple logo with the progress bar and this time instead of disappearing, it started to fill in.
    End result, a successful restore to factory settings and a happy 14 year old.
    Hope this helps others.

  • Saving table cell editor value when switch to other cell

    Hello,
    I have the code below to allow user entering integer values in a table cell. What I want is that if the user switch to an other cell than I want to save the editor value. It works fine if the user press the Enter button, but how can I do this when user clicks or press tab, arrow to switch to an other cell?
    public class IntegerEditor extends AbstractCellEditor implements TableCellEditor, ActionListener{
         JFormattedTextField component = new JFormattedTextField(NumberFormat.getIntegerInstance());
         public IntegerEditor(){
              component.addActionListener(this);
                                              component.setBorder(null);             
         public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
                          if (value != null)  component.setValue(value);
                          return component;
         public Object getCellEditorValue() {
              return Integer.valueOf(component.getValue().toString());
         public void actionPerformed(ActionEvent e) {
              fireEditingStopped();
    }

    Hello camickr,
    I add a column to the table with the function see below.
    With this sollution I the cell value saving is working fine, but it accept string vales for me :(
    If I use the JFormattedTextField than it accepts only integers but I have the original problem. I'm using fireEditingStopped(); in the focusLost method but it has no effect.
    What do I wrong?
    public TableColumn addNewIntegerColumn(java.lang.String caption, int width, boolean fix) {
          //Switch off AutoCreate
          this.setAutoCreateColumnsFromModel(false);
          //Create a new Column
          TableColumn col = new TableColumn(dataSheet.getColumnCount(),width,new LabelRenderer(),this.getDefaultEditor(Integer.class) );
          //Set column header
          col.setHeaderRenderer(new HeaderRenderer());
          col.setHeaderValue(caption);
         if (fix) col.setResizable(false);
          col.setPreferredWidth(width);
          //Add column to the table
          this.addColumn(col);
          //Add column to the model
          dataSheet.addColumn(caption);
          return col;
    }

  • Beginner question: Can I apply one formula to all cells in a column?

    Hi,
    I'm new to spreadsheets, so apologies for asking what is probably a very simple question.
    I want to apply a formula that divides the values in one column (W) by values in another (AX) for a table containing 3000 rows, and outputs the result for each row into the appropriate cell in the new column I've created.
    Numbers 09 'help' hasn't helped to this point.
    Thanks in advance for any assistance.

    GeoBrett wrote:
    Numbers 09 'help' hasn't helped to this point.
    Besides Numbers '09 Help there are two other useful resources available in the Help menu: the Numbers '09 User Guide and iWork Formulas and Functions Help.
    For "Beginner questions," my first choice would be the User Guide. For the specific question you asked, a quick scan of the chapter on "Using Formulas and Functions" (pp 83-96) will provide some useful information. Start in the neighborhood of page 93.
    Regards,
    Barry

  • Please help-- PSE 7 editor problem

    When I open PSE 7 in edit I get the following message:   Photo Shop Element (Editor) has stopped working.  A Problem caused the program to stop working correctly.  Close the program.
    I have uninstalled the program, reinstalled and it works okay for about a week.  Then the message reappears.  I've done this 3 times [uninstalled, installed].    I tried opening Organize and it works properly.  I tried to go into edit from organize but get the error message when edit opens. Can someone help me, please.  Thanks, Doris

    Can you reimage your machine  and try thhis out again.

Maybe you are looking for

  • How To Fetch the Content of a File from Client's PC?

    In my JSP I have this:      <input type="file" name="filename">for visitors of the web page to browse their PCs' directories to select a file to upload (when the Submit button is clicked). What appears in the text field will be a file name. How do I

  • TNS-12560: TNS:protocol adapter error (when starting database)

    Hi.. everyone. I am testing oracle9i and oracle10g on the same machine, windows xp pro. When I was trying to start oracle10g using command line mode, I got the error, TNS-12560: TNS:protocol adapter error. I entered these command. set oracle_home=10g

  • File Adapter XML

    Hello, I've a interface RFC - File (Message Protocol: File -Don't FCC-l ) The file XML generated is OK, but when i open this file with the text editor, i see the file of follow: <tag1>value1</tag1><tag2>value2</tag2><tag3>value3</tag3>  and i need se

  • Reg: dtps and infocubes,Dsos in bi 7

    HI All,             Can you please explain in details about types of dtps and use(singifiance of each dtp) them in bi 7 as well as cubes and dsos, please do not send links it is difficult to get what i want. Thanks in advance Vis Please search the fo

  • Why isn't newly installed hard drive available for startup?

    Here's what I did: 1. Backed up Macbook Pro data to external drive.  2. Installed new hard drive in Macbook Pro  3. Put old drive in hd enclosure 4. Connected old drive in enclosure to Macbook Pro via USB 4. Formatted new drive using Disk Utilities f