How to display non-URL-based thumbnail images in JTable

I'm trying to display thumbnail images as a tooltip popup for certain cells in a JTable. The thumbnail images are java image objects that have been retrieved dynamically as the result of a separate process--there is no associated URL. For this reason, I can't use the setToolTipText() method of the JTable.
My attempts to JTable's createToolTip() method also failed as it seems the ToolTipManager never calls this method for a JTable.
As a workaround, I've added a MouseMotionListener to the JTable that detects when the mouse is over the desired table cells. However, I'm not sure how to display the popup over the JTable. The only component that I can get to display over the JTable is a JPopupMenu, but I don't want to display a menu--just the image. Can anyone suggest a way to display a small popup image over the table?
Thanks.

Thank You Rodney. This explains why my createToolTip() method wasn't being called, but unfortunately I'm no closer to my goal of displaying a true custom tooltip using a non-URL image rather than a text string. If I make a call to setToolTipText(), at any point, the text argument becomes the tooltip and everything I have tried in createToolTip() has no effect. However, as you pointed out, if I don't call setToolTipText(), the table is not registered with the tooltip manager and createToolTip() is never even called.
To help clarify, I have attached an SSCCE below. Please note that I use a URL image only for testing. In my actual application, the images are available only as Java objects--there are no URLs.
import javax.swing.*;
import java.awt.*;
import java.net.URL;
import java.net.MalformedURLException;
public class Test {
    static Object[][] data = {
            {"Cell 0,0", "Cell 0,1"},
            {"Cell 1,0", "Cell 1,1"}};
    static String[] columnNames = {"Column 0", "Column 1"};
    static JFrame frame;
    static String testImageURLName = "http://l.yimg.com/k/omg/us/img/7c/0a/4009_4182164952.jpg";
    static JTable testTable = new JTable(data, columnNames) {
        public JToolTip createToolTip() {
            System.out.println("testTable.createToolTip() called");
            Image testImage = getTestImage();
            // this.setToolTipText("Table ToolTip Text");
            JLabel customTipLabel = new JLabel(new ImageIcon(testImage));
            customTipLabel.setToolTipText("Custom ToolTip Text");
            JToolTip parentTip = super.createToolTip();
            parentTip.setComponent(customTipLabel);
            return parentTip;
    // This image is loaded from a URL only for test purposes!!!
    // Ordinarily, the image object would come from the application
    // and no URL would be available.
    public static Image getTestImage() {
        try {
            URL iconURL = new URL(testImageURLName);
            ImageIcon icon = new ImageIcon(iconURL);
            return icon.getImage();
        catch (MalformedURLException ex) {
            JOptionPane.showMessageDialog(frame,
                    "Set variable \"testImageName\" to a valid file name");
            System.exit(1);
        return null;
    public static void main(String[] args) throws Exception {
        frame = new JFrame("Test Table");
        frame.setSize(300, 100);
        // Set tool tip text so that table is registered w/ tool tip manager
        testTable.setToolTipText("main tooltip");
        frame.getContentPane().add(testTable);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
}

Similar Messages

  • How to register non-wsdl based URL in OEG

    How do we register a non-wsdl based URL endpoint in OEG? We had no problem registering a simple WSDL based endpoint on an OEG server. However we cannot find documentation on how to secure/register a RESTful or JSON – URL based service (SOAP, XML over HTTP type service).
    Does this functionality exist? Or are there best practices on what to do with OEG for these types of services?
    Our use case looks like:
    Akamai - - > OEG - -> OSB (WSDL, RESTful, JSON type web services) - -> .Net service (WSDL, RESTful, JSON type web services)

    In case of REST and other non-WSDL type services, there is no SOAP/WSDL based web service like registration process, you'd use OEG as the proxy. You can receive REST based requests at OEG, retrieve parameters (there are convenience filters available for retrieval of attribute values and other types of REST related functions in OEG, as part of the Policy library, "Extract REST Request Attribute", "Validate REST filter", "Create REST Request" etc. - search for REST at the top using Policy Studio, drag it on to canvas and click help for docs on these filters) and do the routing to actual REST end point services. You have the option to receive and use the SOAP message as a basis of generation of the REST url.
    REST to SOAP - http://www.soatothecloud.com/2008/11/how-to-convert-from-rest-to-soap.html
    SOAP to REST - http://markoneill.sys-con.com/node/1989916
    On use with JSON: you can convert XML to JSON on the outbound side to serve mobile clients etc. using script based(standard XSLT) conversions at the gateway. Conversions to Java using google gson library is also an option.
    To register a REST service, simply map the path (e.g. "/MyRESTService") to the policy you're using to process the REST request.
    Let's say you want to simply route a REST request through OEG (e.g. - to OSB). You would create a policy (right-click on "Policies" and add it). Drag in a "Static Router" filter and place in it the hostname and port of the host you want to route to (e.g. - to OSB). Then right-click on it and choose "Set as start" so that it is the first thing which is processed for this REST request. Then drag in a "Connection" filter, and chain it (using a green arrow) after the Static Router filter. The "Connection" filter actually makes the connection to the backend host.
    Now, map the path (using "Add Relative Path") to the service so that if a REST request to "/MyRESTService" or "/MyRESTService/something" comes into OEG, it is routed on to the backend host.
    Deploy your policy (using F6 or the "deploy" button on the Policy Studio toolbar). Then send in your REST request.
    There is actually already a simple REST service setup on OEG, called "healthcheck". If you point a browser to http://<OEG_IP_ADDRESS:8080/healthcheck" then this is run.
    If the backend REST service returns JSON, the response JSON will simply be sent back through OEG.

  • How to display a URL in Portal

    Hi friends
    I am an XI guy trying to figure out how to display an IVIEW in the portal.
    I have a URL that I want to display in EP.
    What are the steps to do this?
    Any help will be greatly appreciated.
    Thanks
    Ram

    Hi Ram,
    You can create an URL iview and below is the link that helps you in doing that
    http://help.sap.com/saphelp_nw70/helpdata/EN/4c/eee2bedf3b4082b14a933e5ee63472/frameset.htm
    reward points if helpful

  • How to display "Non-Fatal Run-Time Error In Function Panel" dialog?

    I'm learning how to develop an IVI-C specific driver using LabWindows/CVI. When I run my function from its function panel and it returns an error, I would like to display a dialog with both the error code and error message (as opposed to simply returning an error code on the function panel). This would save the user from having to call Prefix_error_message() to translate the error code to its error message. NI-DCPower driver is a good example of this behavior (see attached error dialog). How do I show the "Non-Fatal Run-Time Error In Function Panel" dialog? Any help is greatly appreciated. Thanks!
    Attachments:
    ErrorDialog.png ‏8 KB

    Hi Shawn,
    Thank you for replying to my post. The checkErr is just an error handling macro defined in ivi.h to goto Error: tag when the function returns a non-zero value. I have been using the checkErr macro (as well as viCheckErr and other macros) in my driver.
    Using the same hp34401a specific driver as an example, please allow me to explain my question in more details:
    Let's take the hp34401a_close function as an example. It is a simple function with only a few lines of code:
    When the hp34401a_close function is run from its front panel using an invalid session handle (e.g. "8" in this screen capture):
    You will get three "Non-Fatal Run-Time Error" popup dialogs, one from each of the IVI library functions that it calls: Ivi_LockSession, Ivi_UnlockSession, and Ivi_Dispose. However, there is no "Non-Fatal Run-Time Error" popup dialog from the hp34401a_close itself.
    My IVI-C specific driver is behaving identical to the hp34401a specific driver.
    In comparison, if run niDCPower_close function from its front panel using an invalid session handle (using the same "8" in this screen capture):
    You will only get one "Non-Fatal Run-Time Error In Function Panel" from the niDCPower_close function itself:
    I think the behavior of niDCPower driver is much better than the hp34401a driver. It replaces the three "Non-Fatal Run-Time Error" popup dialogs from the IVI library with a single "Non-Fatal Run-Time Error In Function Panel" popup dialog from the driver function itself. I would like to do the same thing with my driver but have not figured out how to display a "Non-Fatal Run-Time Error In Function Panel" dialog. Thanks in advance for your help!

  • How to display screens (tabs) based on user authentication

    hi
    i am new to jheadstart, i want to display screens (tabs) based on users, ie if i have screens of dept, grade, desig, group, type, master etc..
    if user is admin display all the items in tab,
    if user 1 then display only dept, grade, desig
    if user2 then other settings....etc
    how to do this pls help,,,,,
    thx in adv
    Kris

    Kris,
    If you upgrade to JHeadstart 10.1.2.2 (requires a license), you will get built-in support for user authenrication and authorization including showing tabs based on the role. 10.1.2.2. ships with a demo app that uses all these features.
    Steven Davelaar,
    JHeadstart Team.

  • How to I get high res thumbnail images?

    Just discovered once I've imported images into my library Aperture 3.2.2 (running under 10.7.3) doesn't render high res thumbnail images (when the Browser Thumbnail Resize slider is set to the far right/maximum), even though my "Previews" preference settings are as follows:
    "Use embedded JPEG from camera when possible" is unchecked
    "Don't Limit" for Photo Preview is selected
    Photo Preview quality set to 10
    Deleting and regenerating thumbnails doesn't solve the issue. However, if I delete the photo from the referenced library, then reimport the image, the browser thumbnail image renders sharp. The low res thumbnail is at left; high res thumbnail (after re-import) is at right. Both thumbnails images are sharp when the Browser Thumbnail Resize slider is positioned in the middle. Photos render sharp in the Viewer, regardless.
    Going back through my images, it seems Aperture stopped providing a sharp thumbnail image since around July 2010. Other than updating Aperture, my workflow or supported camera hasn't changed. Couldn't find a reference to this issue in the User Manual. Am I missing something a setting somewhere?
    Thanks,
    Eric

    Its unclear if the command Generate Thumbnails actually does anything if the thumbs already exist and as there isn;t a Delete Thumbnails command like there is a Delete preview command there are only two ways to force a new thumb to be generated.
    One is to import the image again and two is to delete the Thumbnail folder in the Aperture library. I don;t know for sure if this will fix you problem but as I said it is the only way to force the generation of the thumbs.
    If you try this make sure you have a good working backup of the library. Nothing here will normally cause data loss but it is always a good idea before messing with the library.
    Quit Aperture, Highlight the library in the Finder and right click, Select show package contents. One fo the folders you'll see is Thumbnails, delete it. Open Aperture.
    Also be aware that the regeneration of the thumbs will take some time. Depending on the size of the library it could be an all day affair. Aperture is usable while this is going on but it will be slower.

  • How can I create a jpeg thumbnail image?

    I'd like to create a clear jpeg thumbnail image of the first page of a document created in InDesign.  It will be used in Constant Contact as a link to the online version of the document.  (Constant Contact doesn't take JPEG's)
    I especially need help making it crisp and clear.
    Thank you!

    And there will be occasions when it's not better, and there are alternative ways to get better results.
    You may not have tested every situation and font, but I've done enough to know that sometimes it doesn't work as expected. And it wasn't a "challenge", it was an observation.
    Here's 3 ways to make a JPEG - and the one that is the best is the one that was exported to PDF and then opened in Photoshop and then Saved as a JPEG.
    .........Direct Export .........................Export PDF................................Export PDF
    .....to JPEG.from ID.....................Open in Photoshop.............Save to JPEG from Acrobat.
    (EDIT - The forum is adding extra compression to the images - I assure you the middle image is the best)

  • How to display an URL in a UTL_SMTP email in a package.

    Hi all, I tried to display this uRL from a text line in a email i send out.
    lv_message :=
                lv_message
             || 'ABCDEFGHIJKLM'
             || lv_bss_siteid_notin_lkup;
          lv_message := lv_message || gv_crlf;
          lv_message := lv_message || gv_crlf;
          lv_message := lv_message || gv_crlf;
          lv_message := lv_message || gv_crlf;This error popss up
    Error(1368,13): PLS-00103: Encountered the symbol "<" when expecting one of the following: ( - + case mod new null <an identifier> <a double-quoted delimited-identifier> <a bind variable> avg count current max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specification> <an alternatively-quoted SQL string>
    Message was edited by:
    CrackerJack

    Hi Billy,
    I grabbed this procedure from metalink.But it does not work.
    CREATE OR REPLACE PROCEDURE sp_batch_email_test
    IS
        mailhost VARCHAR2 (30) := 'smtp.company.com';
        mail_conn utl_smtp.connection;
        crlf VARCHAR2(2) := CHR (13) || CHR (10);
        message_1 LONG;
        v_email varchar2(16000);
    BEGIN
        mail_conn := utl_smtp.open_connection (mailhost, 25);
        utl_smtp.helo (mail_conn, mailhost);
        utl_smtp.mail (mail_conn, '[email protected]');
        utl_smtp.rcpt (mail_conn, '[email protected]');
          message_1 := 'From: Mr Sender < [email protected] >' || crlf ||
             'Subject: Testing Hyperlink' || crlf ||
             'To: Mrs Receiver <[email protected]>' || crlf || '
    || crlf || crlf ;
    utl_smtp.data(mail_conn, 'MIME-Version: 1.0' ||CHR(13)||
    CHR(10)||'Content-type: text/html' || CHR(13)||CHR(10)||message_1);
    utl_smtp.quit (mail_conn);
    END;
    I tried incorporating || 'ABCDEFGHIJKLM' but it displayed as literal and not as a hyperlink.
    Any idea on howto programmatically through PL/SQL send an email which will allow a hyperlink to be created?
    Please click edit to see teh codes.Really appreciate if someone could throw some light into this.
    I don't why that URL is not displaying in the procedure...grr
    Message was edited by:
    CrackerJack

  • How to display a horizontal list of images

    Hello everyone,
    I am new to Flash Builder 4 and I am looking to display a horizontal list of images on my Flex Mobile Project (using Burrito Flash Builder). Can anyone recommend me what component that I should use?
    I know the <s:List /> will display a Vertical list of items, but I am not sure what component to display a horizontal list of items.
    Thanks in advance for any help,

    Have you tried using HorizontalList?
    Here is an example:
    http://flex4fun.com/2010/11/30/flex4-horizontallist-example/

  • How to display different parts of an image

    hi,
    I need to display different parts of an image at specific situations.
    for example, a dice. there is only one image which includes different sides of the dice. and I wanna add
    to my panel one side if one comes, two side if two comes... I mean if one comes then we will display
    from 10 px to 80 px width and from 10 px to 80 px height of the dice image.
    is there any way to obtain this in java?
    thanks...

    import java.awt.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import java.awt.image.BufferedImage;
    import java.util.Random;
    import javax.swing.*;
    public class ImageClipping extends JPanel {
        BufferedImage image;
        Rectangle clip;
        final int ROWS = 3;
        final int COLS = 3;
        public ImageClipping() {
            // Make an image we can clip.
            Dimension d = getPreferredSize();
            int type = BufferedImage.TYPE_INT_RGB;
            image = new BufferedImage(d.width, d.height, type);
            Graphics2D g2 = image.createGraphics();
            g2.setBackground(getBackground());
            g2.clearRect(0, 0, d.width, d.height);
            Font font = g2.getFont().deriveFont(36f);
            g2.setFont(font);
            FontRenderContext frc = g2.getFontRenderContext();
            LineMetrics lm = font.getLineMetrics("0", frc);
            float sh = lm.getAscent() + lm.getDescent();
            int xInc = d.width/COLS;
            int yInc = d.height/ROWS;
            for(int j = 0; j < ROWS; j++) {
                for(int k = 0; k < COLS; k++) {
                    String s = String.valueOf(j*COLS + k+1);
                    float sw = (float)font.getStringBounds(s, frc).getWidth();
                    float sx = k*xInc + (xInc - sw)/2;
                    float sy = j*yInc + (yInc + sh)/2 - lm.getDescent();
                    g2.setPaint(Color.red);
                    g2.drawString(s, sx, sy);
                    g2.setPaint(Color.blue);
                    g2.drawRect(k*xInc, j*yInc, xInc-1, yInc-1);
            g2.dispose();
            clip = new Rectangle(xInc, yInc);
            // Inspect image.
            ImageIcon icon = new ImageIcon(image);
            JOptionPane.showMessageDialog(null, icon, "", -1);
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            Shape origClip = g2.getClip();
            //g2.setPaint(Color.red);
            //g2.draw(clip);
            // Draw clipped image at:
            int x = 100;
            int y = 100;
            // Mark location.
            g2.setPaint(Color.red);
            g2.fill(new Ellipse2D.Double(x-2,y-2,4,4));
            // Position the image.
            g2.translate(x-clip.x, y-clip.y);
            // Clip it and draw.
            g2.setClip(clip);
            g2.drawImage(image,0,0,this);
            // Reverse the changes to the graphics context.
            g2.setClip(origClip);
            g2.translate(clip.x-x, clip.y-y);
        public Dimension getPreferredSize() {
            return new Dimension(400,400);
        public static void main(String[] args) {
            ImageClipping test = new ImageClipping();
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(test);
            f.pack();
            f.setLocation(50,50);
            f.setVisible(true);
            test.start();
        private void start() {
            Thread thread = new Thread(runner);
            thread.setPriority(Thread.NORM_PRIORITY);
            thread.start();
        private Runnable runner = new Runnable() {
            Random seed = new Random();
            Dimension d = getPreferredSize();
            int xInc = d.width/COLS;
            int yInc = d.height/ROWS;
            public void run() {
                do {
                    try {
                        Thread.sleep(3000);
                    } catch(InterruptedException e) {
                        break;
                    int row = seed.nextInt(ROWS);
                    int col = seed.nextInt(COLS);
                    int x = col*xInc;
                    int y = row*yInc;
                    int n = row*COLS + col+1;
                    System.out.printf("row = %d  col = %d  n = %d%n",
                                       row, col, n);
                    clip.setLocation(x,y);
                    repaint();
                } while(isVisible());
    }

  • How to display page number based on group.

    Hi All,
    I have a report and it consists two groups. First group is displaying 20 pages and the second group is displaying 30 pages. My requirement is to display the page numbers based on the group. That is, the second group output page numbers should start with 1 after displaying first group output. So, the page numbers should be as followed in the report output:
    First group page numbers:
    Page 1 of 20
    Page 2 of 20
    Page 20 of 20
    Second group page numbers:
    Page 1 of 30
    Page 2 of 30
    Page 30 of 30
    How do I achieve the above requirement.
    Thanks in advance.

    Post your report related question in the [url http://forums.oracle.com/forums/forum.jspa?forumID=84]Reports Forum, this is the Forms Forum.
    Tony
    Message was edited by:
    Tony Garabedian

  • How to display non modal dialog box in a Dll call from TestStand implemented in visual c

    Dear Jason F.
    Applications Engineer
    National Instruments
    Hello
    I did the same way you told me
    the non modal dialog appeared and
    system hangs and
    giving the error message
    ""SeqEdit.exe-Application Error
    The instruction at �0x047fc5b0� referenced memory at �0x047fc5b0�. The memory could not be �read� ""
    please solve my problem
    and thanks for yours early response
    you can email me at
    [email protected]

    Hi Mkehret,
    Does your dialog have ActiveX controls on it? If your DLL dialog uses ActiveX controls and is not programmed in a certain manner it can hang because of a conflict in the threading model used by the TestStand Engine that is calling into your DLL and the model that is required by the MFC ActiveX Container. If you are using ActiveX controls in your dialog, you need to make special considerations for the threading model MFC dialogs that use ActiveX controls need in order to work properly. The example under \Examples\MFCActiveXContainerDlg illustrates how to appropriately handle this situation as well as explaining why it is necessary.
    Note: The above example displays the dialog as modal, but this is irrelevant to the problem I am describing.
    Again for information on properly creating a dialog class object and displaying it as non-modal refer to the information on MSDN that I referred you to in this post:
    http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=506500000008000000E98A0000&USEARCHCONTEXT_CATEGORY_0=_8_&USEARCHCONTEXT_CATEGORY_S=0&UCATEGORY_0=_8_&UCATEGORY_S=0
    If your dialog does not use ActiveX controls or after trying the programming method illustrated in the "MFCActiveXContainerDlg" example TestStand still hangs when calling your DLL, try calling your DLL from another environment just to make sure whether the DLL works at all. If the DLL works properly when called by another environment (e.g. VB, VC++, LabVIEW, or CVI), please submit a MINIMAL and REPRODUCEABLE example source project for your DLL for us to look at (please exclude all unnecessary code not required to reproduce the specific problem of displaying the dialog, and include all files necessary to build your dll with any
    specific instructions needed to do so).
    Jason F.
    Applications Engineer
    National Instruments
    www.ni.com/ask

  • How to display non-continuous lines in a 2D Line flash chart ?

    Hi
    I am making 2D lines charts. is there a way ig tehre are no data in the table, to not to display points ?
    For example I have a table with this data :
    Date     Value
    01/01/09 2
    02/01/09 7
    03/01/09 4
    05/01/09 3
    06/01/09 2You see in the example anove that there is no data for the day 04/01/09.
    I would like the chart no to display any point for that day and start again for date following. This means displaying a non-continuous line.
    I hope I am clear.
    I tried but had no solutions. Would you have any idea on this ?
    Thank you for your kind help !
    Christian

    Hi Christian
    You're missing a lot of the XML build up from the website.
    You also need to return the string "Missing" for each date that you haven't got.
    Try this to get you started (you'll certainly need to fiddle with it to get it working)...
    DECLARE
       l_xml   VARCHAR2 (32767);
       start_date DATE;
       end_date DATE;
       the_date DATE;
       count_holder VARCHAR2(10);
    BEGIN
       l_xml :=        '<anychart> ';
       l_xml := l_xml||'<settings> ';
       l_xml := l_xml||'<animation enabled="True"/> ';
       l_xml := l_xml||'</settings> ';
       l_xml := l_xml||'<charts> ';
       l_xml := l_xml||'<chart plot_type="Scatter"> ';
       l_xml := l_xml||'<chart_settings> ';
       l_xml := l_xml||'<chart_background> ';
       l_xml := l_xml||'<border color="#990099"/> ';
       l_xml := l_xml||'</chart_background> ';
       l_xml := l_xml||'<title enabled="true"> ';
       l_xml := l_xml||'<text> Something </text> ';
       l_xml := l_xml||'</title> ';
       l_xml := l_xml||'<axes> ';
       l_xml := l_xml||'<x_axis tickmarks_placement="Center"> ';
       l_xml := l_xml||'<title enabled="true"> ';
       l_xml := l_xml||'<text>Date</text> ';
       l_xml := l_xml||'</title> ';
       l_xml := l_xml||'</x_axis> ';
       l_xml := l_xml||'<y_axis> ';
       l_xml := l_xml||'<scale minimum="1" type="Linear"/> ';
       l_xml := l_xml||'<title enabled="true"> ';
       l_xml := l_xml||'<text>Count</text> ';
       l_xml := l_xml||'</title> ';
       l_xml := l_xml||'</y_axis> ';
       l_xml := l_xml||'</axes> ';
       l_xml := l_xml||'</chart_settings> ';
       l_xml := l_xml||'<data_plot_settings default_series_type="Line"> ';
       l_xml := l_xml||'<line_series point_padding="0.2" group_padding="1"> ';
       l_xml := l_xml||'<label_settings enabled="true"> ';
       l_xml := l_xml||'<background enabled="false"/> ';
       l_xml := l_xml||'<font color="Rgb(45,45,45)" bold="true" size="9"> ';
       l_xml := l_xml||'<effects enabled="true"> ';
       l_xml := l_xml||'<glow enabled="true" color="White" opacity="1" blur_x="1.5" blur_y="1.5" strength="3"/> ';
       l_xml := l_xml||'</effects> ';
       l_xml := l_xml||'</font> ';
       l_xml := l_xml||'<format>{%YValue}{numDecimals:0}</format> ';
       l_xml := l_xml||'</label_settings> ';
       l_xml := l_xml||'<tooltip_settings enabled="true"> ';
       l_xml := l_xml||'<format> ';
       l_xml := l_xml||'Something: {%YValue}{numDecimals:0} ';
       l_xml := l_xml||'Date: {%Name} ';
       l_xml := l_xml||'</format> ';
       l_xml := l_xml||'<background> ';
       l_xml := l_xml||'<border type="Solid" color="DarkColor(%Color)"/> ';
       l_xml := l_xml||'</background> ';
       l_xml := l_xml||'<font color="DarkColor(%Color)"/> ';
       l_xml := l_xml||'</tooltip_settings> ';
       l_xml := l_xml||'<marker_settings enabled="true"/> ';
       l_xml := l_xml||'<line_style> ';
       l_xml := l_xml||'<line thickness="3"/> ';
       l_xml := l_xml||'</line_style> ';
       l_xml := l_xml||'</line_series> ';
       l_xml := l_xml||'</data_plot_settings> ';     
       l_xml := l_xml||'<data> '; 
       l_xml := l_xml||'<series name="Count"> ';     
       start_date := TO_DATE('01/01/2009');
       end_date   := TO_DATE('10/01/2009');
       the_date   := start_date;
       WHILE the_date <= end_date
       LOOP
        SELECT DECODE(COUNT(*),0,'Missing',COUNT(*))
        INTO the_count
        FROM evv_stpl
        WHERE date1 = the_date;
        l_xml := l_xml || '<point name = "'|| the_date ||'" y="'|| the_count ||'"/>';
        the_date := the_date + INTERVAL '1' DAY;
       END LOOP;
       l_xml := l_xml ||'</series> ';
       l_xml := l_xml ||'</data> ';
       l_xml := l_xml ||'</chart> ';
       l_xml := l_xml ||'</charts> ';
       l_xml := l_xml ||'</anychart>';
       HTP.p
    <html>
    <head>
    <title>AnyChart Sample</title>
    <script type="text/javascript" language="javascript" src="D:\oracle\product\10.2.0\apache\Apache\Apache\images\flashchart\AnyChart.js"></script>
    <body>
    <div id="chartDiv-1"></div>
        <script type="text/javascript" language="javascript">
        //<![CDATA[
        AnyChart.swfFile = ''D:\oracle\product\10.2.0\apache\Apache\Apache\images\flashchart\AnyChart.js'';
        var chart = new AnyChart();
        chart.width = "800";
        chart.height = "600";
        var data = '''
           || l_xml
           || ''';
        chart.setData(data);
        chart.write("chartDiv-1");
        //]]>
        </script>
    </body>
    </html>
    END;Hopefully you understand what I'm trying to do here, unfortunately I can't try it out myself at the moment.
    Maybe if you get stuck you could post it on apex.oracle.com?
    Cheers
    Ben
    Oops, handled a count of zero incorrectly - amended
    Edited by: Munky on May 7, 2009 1:17 PM

  • How to display a blob as an image

    I am working on an application which stores images in a database as blobs. I need to extract these images and display them from a web page. How do I go about this using JSP or JSF?
    Werner

    Thanks for the quick response, matlas. I should have included more info in my original post. I am familiar with reading/writing blobs from the database. The part I am stuck on is how does the java servlet return the blob (dPhoto below), to the web page?
    i.e. from <img src="employeePhoto.jsp&empId=123">
    ImageIcon dPhoto = null;
    // open connection
    Connection photoConnection = startup.openSQLConnection(SQLDriver, SQLConnectionString);
    // setup select string
    String sqlStatement = "select Binary_Photo from employeephoto where Employee_ID = '"+employeeID+"'";
    try {
    // perform select
    ResultSet rs = photoConnection.createStatement().executeQuery(sqlStatement);
    // if record found process blob
    if (rs.next()) {
    // get blob
    Blob image = rs.getBlob("Binary_Photo");
    // setup the streams to process blob
    InputStream input = image.getBinaryStream();
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    // set read buffer size
    byte[] rb = new byte[1024];
    int ch = 0;
    // process blob
    while ((ch=input.read(rb)) != -1) {
    output.write(rb, 0, ch);
    // transfer to byte buffer
    byte[] b = output.toByteArray();
    input.close();
    output.close();
    // load final buffer to image icon
    dPhoto = new ImageIcon(b);
    catch (Exception exc) {/ do your exception processing}
    // close connection
    startup.closeSQLConnection(photoConnection);
    // dPhoto holds image or is null at this point.

  • ABAP Query - How to display non-zero entries

    Hi All,
    I have created a simple query having the join of 4 tables.
    Now I need to display the output for only non-zero entries of a particular field.
    How this can be achieved ?
    Please let me know-
    1) Either , there are ways to restrict the entries during selection itself(I do not want to give this field in selection screen)
    2) Or , Delete the entries having zero value before display.
    I debugged the standard report for query and found out the internal table where the
    result is stored, but it is not allowing to be used in the coding sections of infoset.
    Thanks ,
    Neethu

    In select add condition field1 NE 0 or SPACE.
    Edited by: Shaik Hussain on Nov 30, 2010 1:46 PM

Maybe you are looking for