Color a cell when i select THAT cell

Hi!
I searced for something about my question, but i didn't find anything about it :/
I have to color one cell of a JTable when i select it and make some operation.
I tried with this:
java.awt.Component cell = jTable1.getComponentAt(jTable1.getSelectedColumn(),jTable1.getSelectedRow());
                 cell.setForeground(java.awt.Color.red);But it color all my table and not THE cell that i've selected.
If i've understood, the overriding of the metods prepareRenderer (or similar, i don't remember its exact name) sets the color of cells under particulare condition, but i think i don't need it: i have to color a cell only when i select it.
Thank you!

but i think i don't need it: i have to color a cell only when i select it. Why don't you think you need it. You have a special requirement that you only want to give the cell a specific color when it is selected. So the prepareRenderer() method should do what you want.
If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.
Don't forget to use the [Code Formatting Tags|http://forum.java.sun.com/help.jspa?sec=formatting], so the posted code retains its original formatting.

Similar Messages

  • The options to copy/paste/add comment are not appearing when I select a cell, any idea what I have done?

    I was working on a spreadsheet, adding comments (yellow comment area), then I decided to see what these arrows do (< > ) I can see they are used for skipping through the comments. But now when I try to add another comment, the option doesn't appear, as well as when I select a cell, the options to delete, copy, cut, paste, etc. do not appear either...
    Does anyone know what I've done and how to fix it?!

    You may have a malware infection.
    Do a malware check with a few malware scan programs.<br />
    You need to use all programs because each detects different malware.<br />
    Make sure that you update each program to get the latest version of the database.
    *http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    *http://www.superantispyware.com/ - SuperAntispyware
    *http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    *http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    *http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    See also "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked and [[Searches are redirected to another site]]
    If you can't fix it with the above listed scanners then you need to ask advise on one of the forums that specialize in malware removal mentioned in the <i>Popups_not_blocked</i> article.

  • I was getting messages that my Aperture Library was full, so I updated to Aperture 5.3.1. When I open it, I'm asked to update my library. When I select that option, I'm told that my library is full. Now I can't access my library at all. What should I do t

    Hi all,
    I was getting messages that my Aperture Library was full, so made an appointment at my closest Mac store, but have to wait 2 days. They advise you to update saoftware before coming in, so I updated to Aperture 5.3.1. When I open it, I'm asked to update my library. When I select that option, I'm told that my library is full. Now I can't access my library at all. What should I do to access my library? Do I have to uninstall 5.3.1 and reinstall an older version?
    Another problem I have recently encountered ... all the up and down scrollers on various screens have disappeared. They reappear fleetingly when I use my up and down arrowa, but I can't always catch them. How do I get my scrollers back?

    Thank you so much for your patient guidance and screen captures.
    You are welcome.
    My external hard drive is properly formatted for Aperture, so I am currently copying my Aperture library to it. That will take hours since it is copying 101 GB.
    o.k.
    I understand that I need to clean some space on my internal hard drive and reformat the Aperture library to get back in operation.
    You need to upgrade the Aperture library to be used with Aperture 3.5.1.  That will happen automatically, when you first double click the copied lirary to open it in Aperture.
    I'll also need to back up my external drive with a new external drive if I make space on my internal drive by removing some photos from there and store them on my current external drive.
    What do you use for backup? If you are using TimeMachine it is better to have only the Time Machine backup on the Time Machine drive . In that case would I put the Aperture library and other data on a new drive and keep the old drive for backup.

  • How do I get a  value of a  cell when user selects in a JTable?

    Hi everybody,
    I need some help in order to complete my task. I 've a JTable. When user selects any particular column . I should able to get user selected value. I added a MouseListener to the table. And I 've written the following code - in mousePressed()
    JTable table = (JTable) e.getSource();
    iint col =JTablePartNumbers.getInstance().getSelectedColumn();
    int row = JTablePartNumbers.getInstance().getSelectedRow();
    System.out.println("row col value" +JTableModelPartNumbers.getInstance().getValueAt(row,col));
    I'm getting col and row value but when I'm using TableModel.getValue(row,col) - it is giving me null value.
    And my getValueAt() method is defined as
    public Object getValueAt( int nRow, int nCol )
         System.out.println("the nRow" nRow "And nCol " nCol "And row count" + getRowCount());
         int rowCount = getRowCount();
         System.out.println("the row count" +rowCount);
    if ( ( nRow < 0 ) || ( nRow >= getRowCount() ))
         return null;
              // Taking
              StartNewRevisedGenericSGMLFragmentsModel row = (StartNewRevisedGenericSGMLFragmentsModel) partNumberDetails.elementAt( nRow );
         //     System.out.println("row value" nRow "Col value" +nCol);
              switch ( nCol )
                   case 0:
                   return row.getParNo();                               case 1:
                        return row.getRev(); // gets model data
                   case 2:
                        return row.getDoneDate( );// gets revision data
              Vector rowVec = (Vector) partNumberDetails.get(nRow);
         return (String) rowVec.get(nCol);
    so please help me out resolving this problem.
    Thanks in advance
    purnima

    try calling jtable.getSelectionModel().addListSelectionListener(...)
    by the way, any good design of a generic UI Table must have a feature to do what you're talking about in an easy way. If it didn't, why would anyone use it?

  • Ordering cells, when the empty subsequent cell has to follow...

    First off I would like to apologize, as my english might not be very good.
    What I am trying to do in Numbers is to organize the first coloumn of cells but keep the following "attached". The problem is that, below the first argument there is an empty cell with other cells on the same line that I would like to keep attached.
    A graphical example might be the following:
    --------(separation line) black bottom border-----------------
    243 description company name date date
    german descr. insurance
    ---------separation line (black bottom border)------------------
    21 description company name date date
    german description insurance
    --------------separation line --------------------------------
    I want to sort them by number. Every word I wrote is in a different cell. I cannot merge all cells because some are formatted as text, other as numbers and others as dates.
    How is the best way to proceed?
    I hope I was able to explain what I mean.
    Message was edited by: iMat77

    Thank you very much for the input and the explanation. (and, of course, also a much better picture than what I was able to write in my post).
    What I wanted to do is actually, in your scheme, to order items by color (assuming color is a number, so it needs to be ascending or descending) but keeping the "definition" (fruit or vegetable) underneath the name of the item.
    To solve this, since I handle with numbers, I decided to "copy" the number (color in your diagram) also in the cell below. This allowed me to order ALL cells in ascending or descending order, without having empty cells that would then be put at the very bottom of the document.
    I know it is not an elegant solution, but it nevertheless solved my problem.
    I suggest Apple takes into consideration an idea that is currently applied to images: the "group" feature. Being able to "group" cells without merging them would solve these and many other sorting problems, creating groups of cells that, when sorted, "stay together".
    Anyways, I would like to thank you a lot for the time, patience and detailed explanation.
    Take care

  • In Music, sometimes an album that has more than one artist, only one shows up, how do I get them all that are all on the album to play in sequence when I select that album?

    I can't figure out why, on my ipod touch in Music, when I select some albums that have more than one artist, the whole album doesn't come up to play all together.  This happens in some compilations, and only ne song shows up from each artist on the album.  Or like on an artist's album that has someone else singing with her.  I get that they are on the same line as an artist, but the album is an album, and when you play an album, the whole thing should play - right?  Thanks for your help!

    Generally all you need do is give tracks from the same album a common Album Artist. See Grouping tracks into albums. The images need an update but the basic info. still holds.
    tt2

  • I have installed Angry Birds Season and the Icon appears but when I select that game it goes back to the main screen???

    I have installed Angry Birds Seasons and the Icon appears but when I select the game it starts to open but then goes back to the home screen.  What to do???

    Try closing the app completely and then see if it works when you re-open it : from the home screen double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Angry Bird Seasons app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    If that doesn't work then you could try a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.
    A third option if neither work is to delete the app and then re-download it

  • Something going seriously wrong with my install of CC. The CC desktop app won't show what apps I have, and when I select that tab the wheel spins for a while and then the app quits. I am running Yosemite 10.

    Something is seriously wrong with my install of CC desktop. The icon won't show up in the upper bar as it always has. When I start it from th finer it starts, but when I select the Apps tab is spins for a while and then quits. Tried re-installing it from Adobe downloads. Same behaviour. What's up?

    Rdgates55 have you utilized the solutions listed in App doesn't open | Progress wheel spins continually?  If so what version of the Creative Cloud Desktop application are you using?

  • When I receive multiple phots as email atachents, I am off "slideshow" as an option. When I select that viewig option, it fails to load.

    Some emails come with several photos as attachments. I am offered an option to download all and an option for slideshow. When I select download, the page keeps working but fails to complete a download. How can I correct?

    Have a read here Transferring files from one User Account to another
    Stefan

  • Focus stays on cell when I select column in JTable

    Hi,
    I am using a JTable and I have defined a function key cntrl-D to perform a function on a selected column. This works fine if I have not yet edited one of the cells in the column, but if I edit any cell and then click the column header and hit cntrl-D, then the column is deselected, the top cell enters edit mode, and my function is called with only one cell selected (always the top cell) instead of the whole column.
    When I debug this, I find that my function is called first, and processKeyEvent in the cell editor is called later. The editor doesn't handle it and calls super().
    I think that somehow the cell is keeping the focus even though I try to deselect it when the column is selected in my column header listener. Any suggestions welcome.
    Here is the code I use to select the column in the column header listener. I have verified that it is called when I click the header:
    public void mouseClicked(MouseEvent e)
    table.requestFocusInWindow();
    Point thePoint = e.getPoint();
    int theColumnIndex = table.columnAtPoint(thePoint);
    int theLastRowIndex = table.getRowCount() - 1;
    if (theLastRowIndex > 0 && theColumnIndex > 0 && theColumnIndex < table.getColumnCount() )
    if ( e.isShiftDown() && table.getSelectedRowCount() == table.getRowCount() )
    table.editingStopped(null);
    if ( table.isEditing() )
    return;
    if ( theColumnIndex <= mColumnStart )
    table.setColumnSelectionInterval( theColumnIndex, mColumnStart);
    else if ( theColumnIndex >= mColumnStart )
    table.setColumnSelectionInterval( mColumnStart, theColumnIndex );
    else if ( e.isControlDown() && table.getSelectedRowCount() == table.getRowCount() )
    table.editingStopped(null);
    if ( table.isEditing() )
    return;
    if (table.isColumnSelected(theColumnIndex))
    table.removeColumnSelectionInterval(theColumnIndex, theColumnIndex);
    else
    table.addColumnSelectionInterval(theColumnIndex, theColumnIndex);
    else
    table.editingStopped(null);
    if ( table.isEditing() )
    return;
    table.clearSelection();
    table.setEditingRow(-1);
    table.setEditingColumn(-1);
    table.setRowSelectionInterval(0, theLastRowIndex);
    table.setColumnSelectionInterval(theColumnIndex, theColumnIndex);
    mColumnStart = theColumnIndex;
    SampleManager.getInstance().setupMenus();

    I found the answer. This is a feature that worked in 1.3.1 but broke in 1.4.1. It turns out that there is a new feature in JTable that jumps into edit mode when a key event is detected, and that causes the column selection to be canceled. To inactivate this feature I put the following line into the constructor of my JTable subclass:
    putClientProperty("JTable.autoStartsEdit", Boolean.FALSE);

  • My pictures are not showing up in the picture folder when I select that folder though the change desktop option.

    My pictures are in jpeg, and I can find them in the picture folder though finder. Any answers?

    now that you have found your iPhoto library you can drag it to the external drive to backup it up
    If you launch iPhoto does it work properly?
    However, when I tried to relocate it to the pictures folder, I get a message that I can't add the library because the folder is defective or damaged.
    Exactly what are you doing? what is the exact error message?
    And as to
    Should I trash the pref file for pictures folder and try again?
    I have no idea what you are speaking of - files and folers do not have Pref files - only applications have Pref files
    LN

  • Display report directly to PDF instead of when user selects that

    Hi, We have a requirement where we want to export report directly to PDF when user runs a report. We have a Java application where parameter screen for Crystal reports is displayed. When user clicks process button after selecting parameter then a new ReportViewer window appears. Right now after running report user selects export option to export to PDF. They want to open report directly to PDF instead of opening report / selecting export option.
    We have Crystal reports saved in BOXI R2 SP3 on IIS.  We are using .NET SDK to do this.
    Thanks,

    You can export and stream directly using RAS.
    [Sample|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b09a5013-9e3b-2c10-41af-85f08f91c895;jsessionid=(J2EE3417700)ID0302179550DB10992550101163851332End]

  • Saved Google Calender as an app tab, now it does a search automatically when I select that tab

    Whenever I click on my Google Calendar App Tab in FF after I open it, I get the Search results screen in GCal, showing no results. I have to hit the "Back to Calendar" option to get to my calendar. I've deleted and resaved the App Tab to be sure I didn't accidentally save it while in the Search Results page, but that hasn't helped.
    Once I've accessed GCal, it doesn't do this again until I close and reopen FF.
    Any suggestions?

    Thanks for the quick replies.
    @cor-el: I think you are correct ... App Tabs do not glow when the content of the page changes (which would result in the tab "glowing" when a new Google Talk message arrived) ... but App Tabs only glow when the tab title changes.
    I thought about writing a java script (to be used with greasemonkey) to change the tab title when a new message arrives in the Google Talk page .... but the Google Talk page looks like it's Adobe Flash.
    I know that there is a "beep" when a chat message arrives, but I wanted some kind of visual notification (like the glowing App Tab) when a message arrives (because my computer is playing music and I don't hear the "beep" when a message arrives).
    Any suggestions for getting a visual notification when new Google Talk chat message arrives?

  • Firefox crashes when I select FILE then OpenFile, and sometimes it lets me get to a file list, but when I select that it crashes

    This has been an ongoing problem, and it does not occur with IE, Opera, Chrome, Browzar, Safari or Avant browsers.
    If I click "File" and then "Open File" it will frequently crash. Sometimes I can navigate to an actual filename in a director, however clicking on that file to open it will crash it. The files can be text files, web pages or photos. It crashes equally among them, or any other file I try to open. There are approximately 65 forwarded messages created by my browser and sent each time this happens but I have never heard from anyone at Firefox about it.

    Ooops. I haven't updated my sig in a while. I'm on 10.8.2 and it happens on a late 2008 Alu Macbook.

  • HT5007 How do I get gmail app update loaded to my ipad3G. My 4G iPad automatically loaded it when I selected that I wanted it installed. But my 1st generation iPad gmail won't open now and I want to install the gmail update and I can't find it in the app

    Please help me to install Google Gmail update app for my First Generation iPad 3G.

    The current version of the Gmail app requires iOS 5 or later.
    What version of iOS is on the iPad in question?

Maybe you are looking for

  • Missing response message in Idoc - WS scenario

    Hello I 'm missing a response message in the follwing scenario: Idoc-> XI -> Web service (SOAP) A Matmas idoc is sent from R/3 to XI. In XI the Idoc is mapped to a SOAP message and sent to a web service. The Message Interface for the SOAP call is syn

  • How to make the new tabs to open the same URL as the startup page?

    Hello! I was wondering if it's possible to configure the Firefox in such a way that the new tabs open exactly the same URL that is typed in the Options. I tried to set browser.newtab.url to about:home but it gives me Firefox Google custom page instea

  • Regarding metalink doc id:112528.1

    my OS is AIX 5.2 and using oracle 10gr2 problem:SQL*Plus hangs when non dba users try to login reason: The customer had recently disabled archiving on the system. They had commented out all of the init<sid>.ora parameters that enable archiving and ha

  • License Problem with Users

    Hi, Good Day! Our client avail of license for 3 for their SAP Business One 2005 A. SP 01 PL 11. accourding to them they can only use 2 license for the users.  I believed that 3x2 would be 6 licenses if Im not mistaken.  But accoirding to them its onl

  • Badi for IE4N transaction

    Hi, I have an requirement like I have rollers like, Equipment Des.---- Equip. No - Material No - Ser No 1. toproll - 10000-- 200-- 1 2. Bottom roll - 10001-- 200-- 2 3 Spare-- 10003 200-- 3 The spare can fit any of the postion either in Top or Bottom