Wrong behaviours with TableCellRenderer

Hi.
I implemented my tablecellrenderer for dates. The problem is that the values of the column I rendered are not visually selected when I click on them.
Moreover:
when I click on a cell, sometimes it changes its content, according to the row I was selecting before.
if three rows have the same date value, all three are selected.
I tried using setOpaque (true) but this selected all the rows in that column.
Here is my renderer..thanks for any little help
public class DateTableCellRenderer extends JLabel implements TableCellRenderer {
Timestamp curDate;
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) {
if(value!=null){
if (value instanceof Timestamp) {
curDate = (Timestamp) value;
SimpleDateFormat a = new SimpleDateFormat("dd/MM/yyyy", Locale.ITALY);
String text = a.format(curDate);
this.setText(text);
if (isSelected) {
this.setOpaque(true);
setForeground(table.getSelectionForeground());
setBackground(table.getSelectionBackground());
} else {
this.setOpaque(false);
setForeground(table.getForeground());
setBackground(table.getBackground());
return this;
}

You're right. I forgot using the code tags to format my class. Here is my situation:
I have a dinamic JTable to which I added a TableSorter. In the model I added object like BigDecimal, Strings and Timestamp and I created a TableCellRenderer for each type I can have inside the table. The wrong behaviours are those described in the previous post.
Any help?
Thanks camickr, but I think that the link you gave me is wrong

Similar Messages

  • Cl_gui_frontend_services= gui_download - wrong behaviour with Windows UAC

    Hello,
    we are using the method cl_gui_frontend_services=>gui_download to store files on the presentation front end (Windows Vista with UAC).
    When the user has no windows rights to the target directory and UAC is active, then the method gui_download stores the file in other directory (C:\Users\<USER_NAME>\AppData\Local\VirtualStore\Windows) and returns with sy-subrc = 0.
    In our opinion this is a critical problem but SAP doesn't want to correct it.
    What do you think about it?
    regards,
    Kris

    Hello kpsgoutam ,
    thank you for your post but it's not an answer for my question. I know how to use 'gui_dowload'. The problem is, it works wrong with UAC and target directory, where you have no rights to write the file.
    Consider following code:
    REPORT ztest.
    DATA:
    " to reproduce the problem the UAC must be active
    " and you can't have write rights to the target directory
      lv_filename TYPE string VALUE 'c:\windows\test.txt',
      lt_data     TYPE TABLE of string,
      lv_data     TYPE string,
      lv_outlen   TYPE i.
    lv_data = 'Some test content'.
    APPEND lv_data TO lt_data.
    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        filename                  = lv_filename
      IMPORTING
        filelength                = lv_outlen
      changing
        data_tab                  = lt_data
      EXCEPTIONS
        file_write_error          = 1
        no_batch                  = 2
        gui_refuse_filetransfer   = 3
        invalid_type              = 4
        no_authority              = 5
        unknown_error             = 6
        header_not_allowed        = 7
        separator_not_allowed     = 8
        filesize_not_allowed      = 9
        header_too_long           = 10
        dp_error_create           = 11
        dp_error_send             = 12
        dp_error_write            = 13
        unknown_dp_error          = 14
        access_denied             = 15
        dp_out_of_memory          = 16
        disk_full                 = 17
        dp_timeout                = 18
        file_not_found            = 19
        dataprovider_exception    = 20
        control_flush_error       = 21
        not_supported_by_gui      = 22
        error_no_gui              = 23
        others                    = 24.
    WRITE: / 'sy-subrc =', sy-subrc. " error: with active UAC the sy-subrc is 0
    regards,
    Kris

  • Strange stack behaviour with referenced files

    I have just started to notice peculiar behaviour with referenced images within stacks. I have been reviewing last years pictures with a view to clearing out the junk.What I have found is rather alarming in that on clicking a stack to open it all the images within the stack were the wrong pictures, wrong as in taken with a different camera in a different year.The top picture does not seem to be affected.On attempting to find the correct files using 'manage referenced files' all the wrong images are shown as found in the list view with their own file names at the same time the thumbnails (top right hand pane) show the original correct file names but with the wrong thumbnails,Aperture does not realise that it is referencing the wrong files and so will not let me reconnect to the correct files.
    Anyone with a similar problem or a cure for this behaviour?

    Ok I have deleted and rebuilt thumbnails files to no avail.
    What appears to be happening is that aperture is using the wrong file-path for the affected pictures.
    I keep all pictures arranged by date order so for example where the correct file path for an image would be;
    Raid Zero/Pictures/2006/0609/060928/pict3722
    Aperture is giving a file path of
    Picture Library/2007/0712/071223/_DCS1023
    in the manage referenced files pane it shows the wrong path as above, the thumbnail picture is of the wrong file but the thumbnail name and date is correct.
    Interestingly since rebuilding the thumbs it is now possible to reconnect to the correct original file whereas before the reconnect option was not available, however it is only possible to do this one file at a time,the re-connect all function does not work presumably because Aperture is not aware that its filepath is wrong.
    Oh dear.... Aperture has just crashed,this immediately after reconnecting 6 files and waiting for the files to update to the correct image in viewer mode.
    GRRRRRRRRR!

  • GR reduction impossible. Wrong CI with FT 30 instead of 40 in GR/IR acct.

    Hi Gurus
    I want to clear my GR/IR G/L account using transaction code MR11 for a Service Order, and I'm getting error message' FMUP009 - GR reduction impossible. Wrong CI with FT 30 instead of 40 in GR/IR acct".
    1. The FT of my GR/IR commitment item master record is currently set to 50 NOT to 30 as mentioned in the error message.
    2. If I change the FT of my GR/IR commitment item to 40 (the correct setting), I still get the same error message as above.
    Note: The offsetting commitment item's master record is set to a 30 (the normal setting for and expenditure commitment item).
    Question: Could this be a program error?
    Regards
    Thuso Mudau

    Hello Thuso,
    The symptom you describe might be solved by these notes
    1027015     MR11 incorrectly updates Funds Management (FM) ->
                    This note is currently being  checked and should be released shortly
    1069481     Unjustified FM error message when posting an invoice receipt
    So, please wait a little bit to have note 1027015 and make sure that both are installed in your system
    Kind regards,
    Mar

  • Strange behaviour with Safari.

    Very strange behaviour with Safari this morning.   Pages loading piecemeal or partially.   The content only becomes viewable after the cursor has passed over the area.   Have cleared caches and reported it but I'm wondering if this is a local matter here in the UK.   Anyone suffering similar problems?    Firefox is responding perfectly normally.

    I see a reply has come back via a previous post.   As I am trying to get a response to this one I shan't reply there but I should point out that for me, this is an isolated problem.   I do use open DNS but with no track history of problems there , I can't blame that.
    In the last few minutes normality has returned.

  • Bug in cursor behaviour with duplicates

    Dear Oracle guys and girls,
    first of all: it sucks that i HAVE to provide business information (company name, address, even phone number) even if i just want to participate in this forum for private reasons. I even have to "unsubscribe" to the newsletters although i never subscribed. Then i have to re-enter my timezone information and email address for the forum, because the settings in my profile are ignored. I think there's some room for improvement in this registration process.
    OK - back to topic. i think i found a bug in the cursor behaviour with duplicate keys. But the behaviour is very consistent, so maybe it's not a bug, but a bad design. (I call it bad because it's totally unexpected and not logical to me).
    I insert some dupes with DB_KEYFIRST; then i create a cursor and iterate over all items in the reverse order (!) with DB_PREV (i also tried DB_PREV|DB_NEXT_DUPE) - no keys are shown.
    Alternatively:
    I insert some dupes with DB_KEYLAST; then i create a cursor and iterate over all items in the reverse order (!) with DB_NEXT (i also tried DB_NEXT|DB_NEXT_DUPE) - no keys are shown.
    cursor->c_get returns the error code -30989 (DB_NOTFOUND).
    Why is it not possible to traverse duplicates in the reverse order? To me it looks like a bug.
    I tested against db 4.5.20.
    Regards
    Chris
    PS: I would love to hear if the bug i reported here: http://groups.google.com/group/comp.databases.berkeley-db/browse_thread/thread/ed471cf6837cb2a6/dd9cda0ad105f401#dd9cda0ad105f401
    will be fixed in the next version.
    Here's a test program:
    int
    main(int argc, char **argv)
    unsigned i;
    int st;
    DB *db;
    DBT key, record;
    DBC cursor, cursor2;
    unlink("test.bdb");
    st=db_create(&db, 0, 0);
    if (st)
    error("db_create", st);
    st=db->set_flags(db, DB_DUP);
    if (st)
    error("db->set_flags", st);
    st=db->open(db, 0, "test.bdb", 0, DB_BTREE, DB_CREATE, 0);
    if (st)
    error("db->open", st);
    memset(&key, 0, sizeof(key));
    memset(&record, 0, sizeof(record));
    st=db->cursor(db, 0, &cursor, 0);
    if (st)
    error("db->cursor", st);
    st=db->cursor(db, 0, &cursor2, 0);
    if (st)
    error("db->cursor", st);
    for (i=0; i<LOOPS; i++) {
    record.data=&i;
    record.size=sizeof(i);
    st=cursor->c_put(cursor, &key, &record, DB_KEYFIRST);
    st=cursor->c_put(cursor, &key, &record, DB_KEYLAST);
    if (st)
    error("cursor->c_put", st);
    while (!(st=cursor2->c_get(cursor, &key, &record, DB_NEXT))) {
    printf("%d\n", *(int *)record.data);
    st=cursor->c_close(cursor);
    if (st)
    error("cursor->c_close", st);
    st=db->close(db, 0);
    if (st)
    error("db->close", st);
    return (0);
    }

    st=cursor->c_put(cursor, &key, &record, DB_KEYFIRST);
    st=cursor->c_put(cursor, &key, &record, DB_KEYLAST);
    if (st)
    error("cursor->c_put", st);
    please delete the first line, it was a cut and paste error. as i said earlier: insert with KEYLAST, query with NEXT.

  • IPhoto behaviour with Albums

    can anyone explain or point me in the direction of the reaoning behind iphotos behaviour with Albums and Smart Albums in 2 situations.
    the first, is when using Airpics App and Server, the second when viewing a shared library.
    my set up is my iPhoto main DB is on a headless Mini. I also have a MBP on the same wireless network that view and controls the Mini.
    in situation 1, when my iPad views my Minis library via thr Airpics apps, it says it only views Albums and Smart Albums, not Events but i can see an item that is an event. it consequently is the last full import i do so is the last import considered an album or smart album?
    in 2, when i view my Mini iPhoto DB on my MBP via sharing, lots of Albums and Smart Albums come up from the past that i have deleted. Where is it gettign this info from? is it old stuff from the Minis DB coming through? Or are these current or old stuf from my MBP somehow? when i open the Minis DB on my MBP using Alt-Open and selecting the DB Directly instead of over sharing, these Albums / Smart Albums dont exist. i only see what i expect to see, Currwnt set up..

    thank you again Terence.
    you see ma bit of an iPhoto Guru, Terence and i dont know how else to contact you and i know its niot right to change a thread half way through but do you have any knowledge on the best way to handle this situation:
    i have my iphoto on my headless Mini, controlled by MBP remotely and within the same Wi fi network when home. Iphoto over both is unusably slow. How could i combat this? im told not to use the Mini Library via MBP sleected via ALT when opening as if WiFi drops out it can corrupt. If i use the Sharing from the iPhoto.Mini to MBP, iPhoto.Mini must be open therefore iPhoto.Mini on Sharing on MBP cant be editted, only viewed. The one utility that helps is the iPhoto Manager but all that essentially does is copy from one to another over WiFi so i dont see the difference in that app doing it or me manually doing it, TBH id rather manually do it.
    And i need to store the iPhoto main DB at home as iTunes and my iPad use it while i'm not there, and its now too big to carry around on a 5 year old MBP.
    I like a lot of others seem lost on how to effectively manage and use iPhoto

  • Strange repaint behaviour with JList & Keyboard actions

    Hi everyone,
    This is my first post to the forum. You guys have been a great help in the past and I hope to contribute more in the future.
    Anyways, I've encountered some strange repainting behaviour with a JDialog that uses a JList and a JButton. The dialog is fairly straight-forward and basically this is how it works (like an open file dialog - yes I'm implementing my own filechooser of sorts):
    * JList lists a number of simple items that the user can select from.
    * Once a selection is made, an Open button (JButton) is enabled.
    * <ENTER> key is registered (using registerKeyboardAction()) with a JPanel which is used as the main content pane in the dialog.
    * The user can either click on the Open Button or hit the <ENTER> key which then closes the dialog and runs whatever logic that needs to.
    Now, the repaint problem comes in when:
    1. User selects an item.
    2. User hits the <ENTER> button
    3. Dialog closes
    4. User brings the dialog back up. This entails reloading the list by removing all elements from the list and adding new ones back in.
    5. Now... if the user uses the mouse to select an item lower in the list than what was done in step #1, the selection is made, but the JList doesn't repaint to show that the new selection was made.
    I didn't include a code sample because the dialog setup is totally straight-forward and I'm not doing anything trick (I've been doing this kind of thing for years now).
    If I remove the key registration for the <ENTER> key from the dialog, this problem NEVER happens. Has anyone seen anything like this? It's a minor problem since my workaround is to use a ListSelectionListener which manually calls repaint() on the JList inside the valueChanged() method.
    Just curious,
    Huy

    Oh, my bad. I'm actually using a JToggleButton and not a JButton, so the getRootPane().setDefaultButton() doesn't apply because it only takes JButton as an input param. I wonder why it wasn't implemented to take AbstractButton. hmmm.

  • Strange behaviour with nested overflow headers

    Hi there,
    I have a strange behaviour with nested overflow headers. I have a hierarchy with some dynamic tables an several headers for the hierarchy steps. When the table entries lead to an page overflow, I would assume, that all parent headers will be shown. But unfortunatley only the last (the deepest in the hierarchy) defined overflow header will be shown. Here you can see a quick example of it. (http://www.nemonon.de/HeaderProblem.xdp)
    Any help would be very welcome.
    Thanks and greetings,
    Joerg

    That will sure work for some requirements and thanks for the ideas. But this would fail for the second table. Perhaps my example xdp only shows the behaviour of the nested overflow headers and it´s structure is reduced to show that. The real situation is a bit different. The parent containers also contain some other content. The Problem is not the table...I've just chosen it to produce some content and another nested header. Just try to uncheck the overflow header of the table. This will lead to, that the next defined header (in this case "HeaderThree" is shown. When you go on by also disabling that header, the next one will be shown...and so on. This shows, that the headers for their own are functional, but they fail in combination.
    Greetings,
    Joerg

  • Client wanted  to delete the document created with the wrong GL with the WB

    Dear All,
    The user had by mistake posted the the document in a wrong GL with with WBS element under the Project.
    We have tried to reverse it through a reversal posting. But it could not be done.
    Client wanted  to delete the document created with the wrong GL with the WBS element.
    How this can be set right?
    Please advice.
    Regards
    Bijudas

    document cannot be deleted in SAP
    reverse the document and then report

  • Client wanted to delete the document created with the wrong GL with the WBS

    Dear All,
    The user had by mistake posted the the document in a wrong GL with with WBS element under the Project.
    We have tried to reverse it through a reversal posting. But it could not be done.
    Client wanted to delete the document created with the wrong GL with the WBS element.
    How this can be set right?
    Please advice.
    Regards

    document cannot be deleted in SAP
    reverse the document and then report

  • Used wrong charger with ipod classic, now it wont turn on, displays the low battery icon even though its connected to the wright adapter

    used wrong charger with ipod classic, now it wont turn on, displays the low battery icon even though its connected to the wright adapter.
    Can anyone help ?
    please?

    WHow long have you left it to charge?  Have you tried resetting it after a short period of time to see if that can help jumpstart the charging process? To do this, press and hold both the Select/Center and Menu buttons together long enough for the Apple logo to appear.
    B-rock

  • Strange account behaviour with active sync

    Hi all,
    i determined a strange behaviour with Active Sync:
    I deleted an Account in IDM but in the active sync log i can always see the account information??
    Thnx Michael

    Although, now that you are doing this
    My workaround is to use an additional offscreen buffered image, do all of my rendering to that, and then at the end copy that image in one go to the drawGraphics from the buffer strategy.you no longer need to use BufferStrategy.Yes, good point. That didn't occur to me.
    The way my implementation is I have a pluggable rendering strategy (i.e. the strategy pattern) where I can choose an implementation that will use the frame's bufferStrategy and drawGraphics, or my own BufferedImage back buffer. In light of what you've said I can easily change my implementation to not use the buffer strategy at all and I should save some rendering time.
    I've found all sorts of weird behaviour when I use active rendering and have the OpenGL pipeline enabled (I need the pipeline enabled because I want accelerated images), e.g. even setting rendering hints can sometimes cause drawString to not output any text after the first frame.
    I was really using BufferStrategy because I wanted to use hardware page flipping and sync my screen updates to the vertical blanking interval which, as it happens, I can't actually get to work - but that's a problem for another day/topic.
    Anyway, I appreciate your follow-up, thanks.

  • FF 4 (mac) doesn't display handcursor in all Flash websites. Also all html websites show strange behaviour with cursor. (blinking cursor in nearby div after clicking a button)

    I'm running Mac OS 10.6
    FF4 doesn't display the hand cursor or type cursor in '''all''' flash websites on links/textfieldss when it should. Highly annoying and disgracing all flashcontent.
    Also with html websites I experienced strange cursor behaviour with FF4. Although it's hard to reproduce the problem. It's very inconsistent.
    I have the feeling in general FF4 should look into it's cursor behaviour on all possible platforms. Mainly Flash.

    I replicated the typing cursor problem on the popular FB. Just click e.g. "x people like this", you'll see you get a blinking type cursor in the "close" button.

  • Override "crtl + tab" key behaviour with "tab" key for JtextArea .

    I am trying to override the "crtl + tab" key behaviour for JTextArea with "tab" key plus add my own action. I am doing the following.
    1. Setting Tab as forward traversal key for the JTextArea (the default traversal key from JTexArea is "crtl + Tab").
    2. Supplementing the "crtl + Tab" key behaviour with my custom behaviour.
    For the point 2 above, I need to get hold of the Action represented by the "crtl + Tab" key so that I could use that and then follow with my own custom action. But the problem is that there is no InputMap entry for "crtl + tab". I dont know how the "crtl + tab" key Action is mapped for JTextArea. I used the following code to search the InputMap.
                System.out.println("Searching Input Map");
                for (int i = 0; i < 3; i++) {
                    InputMap iMap = comp.getInputMap(i);
                    if (iMap != null) {
                        KeyStroke [] ks = iMap.allKeys();
                        if (ks  != null) {
                            for (int j = 0;j < ks.length ;j++) {
                                System.out.println("Key Stroke: " + ks[j]);
                System.out.println("Searching Parent Input Map");
                for (int i = 0; i < 3; i++) {
                    InputMap iMap = comp.getInputMap(i).getParent();
                    if (iMap != null) {
                        KeyStroke [] ks = iMap.allKeys();
                        if (ks  != null) {
                            for (int j = 0;j < ks.length ;j++) {
                                System.out.println("Key Stroke: " + ks[j]);
                }In short, I need to get the Action associated with the "crtl + tab" for JTextArea.
    regards,
    nirvan.

    There is no Action for Ctrl+TAB. Its a focus traversal key.

Maybe you are looking for

  • OAF 12.2.4 - 500 Internal Server Error java.io.IOException when running a page from Jdeveloper

    Hi All, I face the following error message in the web browser when I try to run a simple page from JDeveloper: 500 Internal Server Error java.io.IOException The message is the same when I run the Hello World test from the Tutorials project. Here is t

  • How to use online help instead of local help files?

    I know that if I am looking for help in Adobe Acrobat Pro 9, I can hit F1 or go to Help -> Adobe Acrobat 9 Pro Help... However, I do not like that doing that sends me to the limited help files that are stored on my local drive.  I would like that lin

  • Got a weird CSS problem that only affect IE

    Can anyone help me out here? - its got to be simple: http://www.fatgraphics.com/green/ The problem is with the text in the main area. It does not show up in MSIE 6 or 7. Sometimes if you resize the page then it does, but the bottom is cut off sometim

  • Can't match the quality of a Canon JPEG

    I shoot JPEG and RAW and I have my camera (EOS 1D Mk II) set-up to apply some adjustments to the JPEG image. They are: Pictuyre style Standard, Sharpness 7, Contrast +1, Saturation +1, Colour tone 0, colour space Adobe RGB. I'm very happy with the ou

  • Oracle 9.2i and SQL

    Could not start sqlplus: oracle@pinguin:~> sqlplus Error 46 initializing SQL*Plus Internal error oracle@pinguin:~> Any ideas? Installation completed without any error with oracle 9.2.0.1.0 on SuSE linux 8.0 But without sqlplus I cannot start and stop