Adding Image to table cell

hello,
I want to add Image related to particular file to cell of the JTable,
I already have name of the file in cell but want to display file or directory name with its related icon.
i am using TableCellRenderer ,but don't know how to keep both filename and icon.
tell if you are aware of it.
thanx

The cell renderer component for the DefaultTableCellRenderer is a JLabel and this has a setIcon() method. You can extend this DefaultTableCellRenderer and inside the getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column) method you decide from the parameters which Icon (or ImageIcon) you want to display and then use setIcon() .

Similar Messages

  • Displaying of image in table cells

    Hi,
    I have a requirement where i need to display an image in table cell editor. Can anyone please tell how to do this.
    Thank You,
    Madhavi

    Hi
    The link is related to the same code as well..
    First copy all your images into "project/src/mimes/components/<packagename>"
    1) First create a new column for image and insert Child "Image" UI Element
    2) Create a Context in a view in which you are using Image UI Element
    3) Value Node
    Name : Image
    Cardidality : 1..1
    4) create 2 Value Attributes
    4)a ImageAlt (Calculate property - true)
    4)b ImageSrc (Calculate property - true)
    5)Bind the properties of Image
    alt - Image.ImageAlt
    source - Image.ImageSrc
    6) in getImageSrc()
    //according to your condition use your image
    retrun "XX.gif"
    7) in getImageAlt()
    return "Image Not Available"
    Case 2 :
    1) Add a new String attribute to your existing context
    2) Right click on your table in RootUIElememntContainer
    3) Edit Sturcture Binding
    4) Select the context which you modified , Select next
    5) in the next step for the newly created attribute select imageUIElement as type
    If you want to use that in wdDoinit()
    bind the two string value attributes to alt and source properties of ImageUIElement and write the following code
    in doinit
    wdContext.currentContextElement.set<src>("img1.gif") ;
    wdContext.currentContextElement.set<alt>("Image not found") ;
    Best Regards
    Chaitanya.A

  • Add image to Table cell

    Hi All,
       Based on condition how can i add image to Table cell.

    Hi,
    Its very simple and straightforward.
    All you need to do is:
    1...Create a context(value attribute) of type string.
    2...I am assuming that you have created a table, and mapped its columns with a node.
    3...In the <i>TableCellEditor</i>  of your desired column, map the above context with the <i>imagesource</i> property.
    4...In the code, set the value of this context to the image name(eg: abc.gif), on satisfying of a condition.
    5...However, keep in mind to set the context value to some default blank image in the doinit() of the view, else, you will get a null pointer exception.
    I hope this solves your problem.
    Keep posting if you have any further queries.
    Regards,
    Hanoz

  • Problem in adding image in jtable cells

    hi all.
    im creating a swing application using netbeans 6.0.
    i want to display image in cells of one column.
    for that i set an "image icon" directly to that cell in the "default table model", in that case it is displaying the path of that image in that cell!
    then i created a new label, and set the image as icon of that label. added that label in that cell. in this case it is printing label.tostring() to that cell!!
    please help.
    thanks in advance.

    You need to override getColumnClass to return Icon.class for the column containing the icon. A code snippet that demonstrates how you might do this:      table = new JTable (new DefaultTableModel (data, colNames) {
             public Class getColumnClass (int columnIndex) {
                switch (columnIndex) {
                   case 0: return Calendar.class;
                   case 1: return String.class;
                   case 2: return Icon.class;
                   //case 2: return Boolean.class;
                return null;
          });luck, db

  • What's the best way to place images in table cells?

    I'm working on a basic tooling catalog/list using a table for all of the information.  One of the columns is for an image of the tool.  Is there a way to place each image in a cell and have it resized to fit the cell dimensions (including my text inset settings)?  I'm using CS4 and the images are all tiff files, although I also have psd files of each.  Any suggestions would be appreciated.

    Table cells don't adjust automatically except in the vertical direction when set to "at least" some dimension, and I suspect you don't really want that anyway. Keep in mind that column width is constant through the whole table, so fitting the cell to the largest image is going to give you a giant coumn width that isn't used for smaller product shots in the same table.
    What about making an image frame the size you want, and setting the fitting options to fit proportionally? Copy that frame and paste into the cell, then place the image in the frame.

  • Background Image In Table Cell

    I'm not sure what I'm doing wrong or missing here. This is the first time that I'm using an image as a background. I've made a table with a 100% width with 3 colums and 3 rows. The left and right table cells have been merged and the 3 middle rows are at a width of 938 pixels. I have cropped the images correctly. The right column lines up perfectly, but the left column does not line up like it's supposed to with the image. You can take a look at it by going to http://www.wattsconcepts.com/new
    Here is the code below if anyone wants to take a look at it. Any help in solving this is greatly appreciated. I am using Dreamweaver CS5.5
    Thank you for your time!
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Watts Concepts - Kentucky Web Design - Harrodsburg, Kentucky</title>
    <style type="text/css">
    body {
              margin-left: 0px;
              margin-top: 0px;
              margin-right: 0px;
              margin-bottom: 0px;
              background-color: #000;
              background-image: url();
    </style>
    </head>
    <body>
    <table width="100%" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td rowspan="3" align="left" valign="top" background="images/left-index.jpg"> </td>
        <td width="938" align="center" valign="top"><img src="images/logo-index.jpg" width="938" height="172" /></td>
        <td rowspan="3" align="left" valign="top" background="images/right-index.jpg"> </td>
      </tr>
      <tr>
        <td align="center" valign="top"><img src="images/eye-index.jpg" width="938" height="296" alt="Reach Your Audience Today" /></td>
      </tr>
      <tr>
        <td align="center" valign="top"><img src="images/test-index.jpg" width="938" height="197" /></td>
      </tr>
    </table>
    </body>
    </html>

    Your HTML code should ideally be as follows:
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Watts Concepts - Kentucky Web Design - Harrodsburg, Kentucky</title>
    <style type="text/css">
    body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    background-color: #000;
    </style>
    </head>
    <body>
    <table width="938px" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="938" align="center" valign="top"><img src="images/logo-index.jpg" width="938" height="172" /></td>
      </tr>
      <tr>
        <td align="center" valign="top"><img src="images/eye-index.jpg" width="938" height="296" alt="Reach Your Audience Today" /></td>
      </tr>
      <tr>
        <td align="center" valign="top"><img src="images/test-index.jpg" width="938" height="197" /></td>
      </tr>
    </table>
    </body>
    </html>
    Also, you don't need 3 columns for this website. 1 column and 3 rows should do. Also, never use 100% for <table> width. It's bad practice as you're making your site fluid which will render your site to malfunction on some browsers
    And you had the entire 3 sections as 1 image as your CSS body background-image. This is bad practice. Crop only what you want for each section, never give the entire merged site as 1 image.
    Try the code I've given you above and it should work perfect.
    A quick tip: Try learning and using DIV with pure CSS styling instead of tables. Tables are a thing of the past. You could just google it and you have tons of free resources on how to create a site using DIV. Also, there's a beautiful tutorial posted by one of our senior members here: http://www.adobe.com/devnet/dreamweaver/articles/dw_html5_pt2.html that explains how to create HTML5 site with Pure CSS styling using DIV tags.
    Cheers,
    ST

  • Place image in table cell in pages for iOS 5

    Can I place an image into a table cell in pages for iphone? This would keep me from having to take my expensive MBA out on the dangerous (for the computer) jobsite.  It would change my life to be able to do this on the iphone as my reports require it.  As of yet I've found no way to do this.
    Thanks in advance for your help!
    ~CR

    Put the text cursor in the cell and use the regual Place command. The image will be placed as an inline graphic in the empty paragraph.

  • Insert shape over image in table cell

    Want to use circles, ovals, lines with arrows to point to some part (text or image) of a cell in a table.
    Need to emphasize certain areas of graphics in a document used as a step by step type document.
    If I add the shape outside the table and then try to drag/drop on to the image in the cell, the entire cell jumps to a new empty cell.
    Can nod get image to appear over the image in the table cell.

    Hello,
    do you think about this, please have a look here: http://help.adobe.com/en_US/dreamweaver/cs/using/WSc78c5058ca073340dcda9110b1f693f21-7b86a .html.
    Another way, to add text over an image uses Nancy O.'s Demo here (I would prefer by using PS or similar):
    http://alt-web.com/DEMOS/CSS-Sold-Out-Text-over-image.shtml
    Hans-Günter

  • Images in Table cell

    HI,
    I have to display different images in a SAP .Net tabe control cell depends on the field values from a database. I set the Tabel cell editor property to "Image Instance" and programatically assign the relative path of the image "web resourcesimagesxxx.gif" according to the database field values. I can see at runtime the web source have correct URL to the image source but the image is not getting displayed on the iView. What am I doing wrong?? I follow this article to do the code part
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/nw/dotnet/pdk for .net faq - .net controls.faq
    Please help.
    thanks

    Thanks for the reply guys,
    Here is the code; I'm not using server "itemDtaBound"
    I set the field type as "image instance" at design time and at runtime after reading the data assign the graphics to the control according to the value returned from the database at the Page_Load
    I only took the relevant portion
            Dim sOrderByField As String = ""
            Dim sqlDate As String = FormatDBDateTimeSQL(Format(Now, "MM/dd/yyyy 00:00:00"))
            'Dim ConnStr As String = "server='(local)'; trusted_connection=true; database='tllink'"
            sSQL = "SELECT EmployeeName, BadgeId, Punch_Type,Punch_Date, Punch_time, TerminalID FROM TERMINAL_TRANSACTIONS"
         sSQL &= " WHERE (Punch_Date =" & sqlDate & ") AND (Punch_Type IN ('IN', 'OUT' ,'DEPT' )) AND ((CAST(Punch_Time AS VARCHAR) + '-' + BadgeId) IN"
            sSQL &= " (SELECT (CAST(MAX(PUNCH_TIME) AS VARCHAR) + '-' + BADGEID) FROM TERMINAL_TRANSACTIONS"
            sSQL &= " WHERE  (Punch_Date =" & sqlDate & ") GROUP BY BADGEID))"
    rRec = g_cDB.GetRec(sSQL, , True)
    OleDbDataAdapter1.Fill(dSQLSet,rRec, "TERMINAL_TRANSACTIONS")
            'SQLTable = dSQLSet.Tables(0)
            Dim RowCurrent As DataRow
            Dim tr As SAP.Web.UI.Controls.TableRow
    For Each RowCurrent In dSQLSet.Table("TERMINAL_TRANSACTIONS").Rows
                tr = New SAP.Web.UI.Controls.TableRow
                If IsDBNull(RowCurrent("EmployeeName")) = False Then
                    tr.Cells.Add(New SAP.Web.UI.Controls.TableCell(New TextView(RowCurrent("EmployeeName"))))
                Else
                    tr.Cells.Add(New SAP.Web.UI.Controls.TableCell)
                End If
                If IsDBNull(RowCurrent("badgeid")) = False Then
                    tr.Cells.Add(New SAP.Web.UI.Controls.TableCell(New TextView(RowCurrent("badgeid"))))
                Else
                    tr.Cells.Add(New SAP.Web.UI.Controls.TableCell)
                End If
                If IsDBNull(RowCurrent("Punch_Type")) = False Then
                    If RowCurrent("Punch_Type") = "IN" Then
                        tr.Cells.Add(New SAP.Web.UI.Controls.TableCell(New SAP.Web.UI.Controls.Image("Web Resources/Images/in.gif")))
                    ElseIf RowCurrent("Punch_Type") = "OUT" Then
                        tr.Cells.Add(New SAP.Web.UI.Controls.TableCell(New SAP.Web.UI.Controls.Image("Web Resources/Images/out.gif")))
                    Else
                        tr.Cells.Add(New SAP.Web.UI.Controls.TableCell(New SAP.Web.UI.Controls.Image("Web Resources/Images/transfer.gif")))
                    End If
           End If
           Me.DataTable.Items.Add(tr)
    Next
    My table displays the employee name and badge id but the images are coming as broken link. I added the images to the web resources before deploying the par.
    The follwing is the runtime source from the browser
    </td></tr><tr rr="1"><td tableid="tae241ba0_DataTable" cc="0" rr="1" class="urSTTD urSTTDBdr1" style="padding:0;"><div tabindex="0" ti="0"><span ct="TextView" style="margin:0px;"></span></div></td><td tableid="tae241ba0_DataTable" cc="1" rr="1" class="urSTTD urSTTDBdr" style="padding:0;"><div tabindex="0" ti="0"><span ct="TextView" onkeydown="sapUrMapi_TextView_menuActivate('',event)" class="urTxtStd" style="white-space:nowrap;">000000000003412770</span></div></td><td tableid="tae241ba0_DataTable" cc="2" rr="1" class="urSTTD urSTTDBdr" style="padding:0;"><div tabindex="0" ti="0"><img class="urImg" src="/irj/portalapps/Timelink_Portal_APP/Images/green.gif" ct="Image" border="0" style="height:28;width:30;"></img></div></td><td tableid="tae241ba0_DataTable" cc="3" rr="1" class="urSTTD urSTTDBdr" style="padding:0;"><div tabindex="0" ti="0"><img class="urImg" src="/irj/portalapps/Timelink_Portal_APP/Images/in.gif" ct="Image" border="0"></img></div></td><td tableid="tae241ba0_DataTable" cc="4" rr="1" class="urSTTD urSTTDBdr" style="padding:0;"><div tabindex="0" ti="0"><span ct="TextView" onkeydown="sapUrMapi_TextView_menuActivate('',event)" class="urTxtStd" style="white-space:nowrap;">2/10/2006</span></div></td><td tableid="tae241ba0_DataTable" cc="5" rr="1" class="urSTTD urSTTDBdr" style="padding:0;"><div tabindex="0" ti="0"><span ct="TextView" onkeydown="sapUrMapi_TextView_menuActivate('',event)" class="urTxtStd" style="white-space:nowrap;">07:24:58</span></div>
    as you can see it includes the path to th images green.gif and in.gif
    thanks

  • How do I get rid of white space on one side of image in table cell?

    I'm making a disjointed rollover and when ever I add images it creates too much white space to the right of the cell.  How can I make the picture fit, so space is not wasted?  See image sample with red arrows where I want to remove space.  I've removed the width size from my table, hoping it would "spring to shape" around the images, but no go.

    HTML:
    Cellpadding="0"
    Cellspacing="0"
    CSS:
    table {border-collapse: collapse}
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb

  • Images as table cell content

    Hi,
    we are using thumbnail images for representing some employee status in a table. Images are displayed successfully.
    Problem is the white space between two cells, we want to eliminate the space between two cells. I have tried cell width property but it doesn't help.
    Any other suggestions to achieve this.
    Thanks a lot.
    Rgds

    Hi Sharanya,
    I could not find property cell spacing and cell padding property for cell.
    I am on Nw04.
    Is there other way we can achieve this.
    Rgds

  • Left justify images in table cell

    I have just started trying to learn DW.
    Why do some of my images left justify in the cell (as I want
    them to) while others float out in the center of the cell?

    > working and the code that isn't and deleted some code -
    a blockquote tag
    > ? -
    > that seems to have done the trick.
    It certainly would.
    Until you gain some proficiency with HTML and then with CSS,
    your experience
    with DW will be one of these mysteries after another. The
    problem is, that
    knowledge would PREVENT you from clicking on the icon that
    inserts the
    <blockquote> tag (mistakenly identified as an indent in
    DW) in the first
    place, and would then allow you to find it and remove it once
    it has been
    used.
    Good luck!
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "nugentdav" <[email protected]> wrote in
    message
    news:g2anes$ddi$[email protected]..
    >I have not looked at my code, as you pointed out, I need
    to know html and
    >css
    > to really be proficient with this and get the results I
    want.
    >
    > BUT just by your suggestion I made the comparison
    between the code that is
    > working and the code that isn't and deleted some code -
    a blockquote tag
    > ? -
    > that seems to have done the trick.
    >
    > Thanks!
    > Nugent
    >

  • Adding a single table cell

    In other spreadsheet programs I have been able to add a single cell to a column without having to copy and pste the entire column. Is there a way to do this in Numbers?

    We can do that … if we use one of my scripts
    http://discussions.apple.com/thread.jspa?messageID=6415242
    or, go to my idisk:
    <http://idisk.me.com/koenigyvan-Public?view=web>
    then download:
    foriWork:for_Numbers:move_one_cell_down_orright.zip
    foriWork:for_Numbers:move_one_cell_up_orleft.zip
    Yvan KOENIG (from FRANCE samedi 23 août 2008 13:10:41)

  • Error when adding image in-line with text

    When using some of my templates I have no problem in putting
    a small graphic (a pdf icon) in-line with text. Yet with others the
    insertion of the same small graphic forces a newline before and
    after the graphic.
    If the text and image is placed in an editable region of the
    template, but not within a table cell all is ok.
    If the text and image is place within a table cell within the
    editable region the problem arises. I am sure there is something I
    have specified incorrectly but cannot discover what it is.
    An example of where it works fine is:
    www.digitalfox.co.uk/parryassociates/products.htm
    An example of where it doesn't work is:
    www.bournemouthlittletheatre.co.uk/membership2.htm
    I am using Dreamweaver 8 within Studio 8 and run under
    Windows XP.
    Can anyone help please?
    Regards
    Roger Sansom

    Hmm -
    <style type="text/css">
    <!--
    @import url("nav-bar-top/nav-bar-top.css");
    @import url("nav-bar-top/nav-bar-top.css");
    @import url("nav-bar-top/nav-bar-top.css");
    @import url("nav-bar-top/nav-bar-top.css");
    @import url("nav-bar-top/nav-bar-top.css");
    @import url("nav-bar-top/nav-bar-top.css");
    @import url("nav-bar-top/nav-bar-top.css");
    @import url("nav-bar-top/nav-bar-top.css");
    @import url("nav-bar-top/nav-bar-top.css");
    @import url("nav-bar-top/nav-bar-top.css");
    @import url("nav-bar-top/nav-bar-top.css");
    Is this the belt and bracers approach? 8)
    Anyhow, your problem is in the very first line of one of
    those (take your
    pick) -
    TD IMG {
    DISPLAY: block
    That causes images in table cells to behave as a block tag.
    Block tags
    force all adjacent content to the next line.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "RogerLS" <[email protected]> wrote in
    message
    news:[email protected]...
    > When using some of my templates I have no problem in
    putting a small
    > graphic (a
    > pdf icon) in-line with text. Yet with others the
    insertion of the same
    > small
    > graphic forces a newline before and after the graphic.
    >
    > If the text and image is placed in an editable region of
    the template,
    > but
    > not within a table cell all is ok.
    >
    > If the text and image is place within a table cell
    within the editable
    > region
    > the problem arises. I am sure there is something I have
    specified
    > incorrectly
    > but cannot discover what it is.
    >
    > An example of where it works fine is:
    > www.digitalfox.co.uk/parryassociates/products.htm
    >
    > An example of where it doesn't work is:
    > www.bournemouthlittletheatre.co.uk/membership2.htm
    >
    > I am using Dreamweaver 8 within Studio 8 and run under
    Windows XP.
    >
    > Can anyone help please?
    >
    > Regards
    > Roger Sansom
    >
    >
    >

  • Pages 5.0 removing images from tables.

    After upgrading to Pages 5.0 I now receive a message when opening any file with a table that has images in the cells.  Basically Pages is removing all images from table cells.  Anyone having this problem and is there an easy fix?

    DrBrian, this is what I did to resolve this issue.  I found out that we may still have Pages 09 installed on our systems! Go into Finder - Applications.  If you have a folder titled iWork 09 click it and you may find Pages 09 there.  Double click to open Pages version 09 where you will be able to open all of your files just as they should be. 
    I will not be using the new Pages upgrade.  I have too much time invested in creating documents and templates for my business and I am not willing to re-learn a new package which has much less functionality.  Hope this helps you.

Maybe you are looking for