JTextPane and images in html

I have a problem with rendering of images in a JTextPane rendering of images.
Only parts of the images are rendered (like 50x50 pixels). When i move the mouse inside the pane everything renders correctly.
Am I doing something wrong? Or is this a known problem? (From different posts on the Internet I understand that JTextPane has problems)

Think I've solved the problem.
using method updateUI() inherited from JTextComponent

Similar Messages

  • How to embed image in html when using JTextPane, HTMLEditorKit, JavaMail

    I am developing a specialized e-mail client that has to be able to send e-mail messages (in html format with images and attachments) that can be read by standard e-mail clients, and receive similar messages from standard e-mail clients.
    I have everything working except for embedding images.
    Images are to appear in the document mixed in with the text, but that's not what I mean by "embed". By "embed" I mean that the image itself is encoded within the html.
    Here's a bit of code to set the context.
    JTextPane bodyPane = new JTextPane();
    bodyPane.setEditorKit(htmlEditorKit);
    bodyPane.setTransferHandler(new DropHandler());
    bodyPane.setDocument(new HTMLDocument());
    In the DropHandler I have the following:
    HTMLDocument htmlDoc = (HTMLDocument) bodyPane.getDocument();
    HTMLEditorKit htmlKit = (HTMLEditorKit) bodyPane.getEditorKit();
    int caretPos = bodyPane.getCaretPosition();
    At this point get "filename", the full path to an image file that has been dropped onto bodyPane.
    String htmlString = "<img src=\"file:///" + filename.replace("\\","/") + "\">";
    htmlKit.insertHTML(htmlDoc, caretPos, htmlString, 0, 0, HTML.Tag.IMG);
    This works just fine. The image is displayed in the document at the point of insertion.
    However, the image itself is an external file. I need to send an e-mail with this image and could send the image file as an attachment, but I obviously can't assume that the recipient of the email is going to save the attachment into the proper location.
    What is the best way to do this?
    There is a technique for embedding the actual image in the html, using this syntax:
    String htmlString = "<a href=\"data:image/png;base64,---mimed png image here--\" alt=\"Red dot\"></a>";
    I can't get this to work in JTextPane, so perhaps it's not supported. Also, there may be limitations on the size of an image. And apparently Internet Explorer doesn't support this.
    From what I read, using a "content identifier", that is, "cid:" and adding the image as another part of the e-mail message is probably the thing to do. I haven't taken the time to explore this yet.
    Does JTextPane support cid? Is that a nonsense question? I suspect what I need to do when the message is being composed is use absolute paths to local files with the images, and then when assembling the e-mail, attach the files and rewrite the html to build in the cid linkage. Similarly, when reading a message with cid's, the thing to do is save the body parts as files and rewrite the cid to point to the actual file.
    I have seen others ask similar questions, one as recently as last December, and the reply was to refer to a Sun tutorial. But that tutorial doesn't address the full problem of 1) inserting an image into a document (instead of attaching an image to a component) and 2) sending it as an e-mail message.
    I have yet to see an example that shows the complete package.
    Am I right that the data option I mentioned is not going to work?
    Am I right that cid is the best approach, and do I understand how to use it?
    Is there something else?
    Thanks
    John

    Hi Rocky,
    Are you using the DC?
    if yes then you need to put the image inside the component folder. after that close the application
    & reopen. You will get the image.
    In case this does not work then try refreshing the portal through server side. Once the cache is cleared, it will be up to view.
    Also check the Activity list you have created. It should be added to the dtr properly or else it wont be reflected once reimported the configurations.
    Regards
    Chander Kararia

  • HTML Gallery, metadata and image download

    hi,
    I find Bridge collections really useful and output to html gallery template pretty good looking as a quick way to show prospect clients themed presentations of my work. There are two issues though which I hope someone can help with, or that Adobe would change if  listening in on this.
    Whereas the html gallery template reads the metadata like description, title and filename,  metadata is being stripped from the image when image is downloaded from gallery. 
    That the image can be downloaded and that meta data is stripped from the image files are two reasons not to use what otherwise could have been an excellent product.
    I would prefer the coding of this html gallery to prevent download of individual image files and as content providers we totally rely on metadata being contained with image file. Are there ways I can change this without going to script amendements?
    If the solution should not be with adobe, could anyone suggest another product that could cater for this need?
    Many thanks in advance.
    Torunn

    Amendments (and apologies for errors in my original post. Copyright status, -notice and -url are indeed contained in metadata for downloaded image, so not so bad then Wish list thus shortended to description field and the IPTC contact data. Though why not all?

  • Can't select text when export in HTML and Images

    I am entirely new to Fireworks and I can't find anyone to teach me Adobe Fireworks. I followed some youtube tutorials but most of them are vague. I am still figuring the way to export from Fireworks to Dreamweaver, without affecting its contents like bitmap images and the text. When I export in HTML and Images format and opened the htm file, I can't select the text I've inserted in Fireworks. Can anyone tell me what I should do?

    I cant scroll below or above viewable section of text in any of my Macbooks, iMac, Mac Mini. Never have been able to, never could, except by pressing the arrow keys whilst selecting, to move up or down.
    Its stupid
    I dont have flash installed (never will do since my first virus of video ad sound running in background from Cnet was downloaded and kept returning until i deinstalled flash).
    I believe that this is a universal issue because none of my Macs can scroll out of screen when selecting text, which as a webmaster and developer, is a pain in the butt
    My issue is not in word documents, its in everything

  • Aligning text and images in a StyledDocument like 'middle' on img in HTML

    Hi,
    I have a StyledDocument which is a document source for a JTextArea, into which I am inserting combinations of 22x22 images and text strings. This is just a nitpick, and I am hoping someone could assist.
    What I would like to do is middle-align the text and images, so that the strings are vertically centered with the images.
    You can reproduce this as such:
    messagePane = new JTextPane();
    messagePane.setMargin( Constants.smallInset );
    doc               = (StyledDocument)messagePane.getDocument();
    Style style;
    style = doc.addStyle( "normal", null );
    StyleConstants.setForeground( style, Color.BLACK );
    StyleConstants.setFontFamily( style, "Verdana" );
    StyleConstants.setFontSize( style, 12 );
    style = doc.addStyle( "image", null );
    StyleConstants.setIcon( style, new ImageIcon( someimageofyourchoice )  );
    doc.insertString( doc.getLength(), " ", doc.getStyle( "image" ) );
    doc.insertString( doc.getLength(), "some misaligned text", doc.getStyle( "normal" ) );Thanks in advance!
    Alex

    code correction:
    top block:
    messagePane = new JTextPane();
    messagePane.setMargin( Constants.smallInset );
    StyledDocument doc = (StyledDocument)messagePane.getDocument();cut + paste from several separate components...

  • Can I generate html and images from the same script?

    I am trying to create a script that generates both html and gif images. Is there a way using the multipart mime content type to create a single stream that includes both html and images?

    No. Facing pages has been removed from Pages 5 along with 100 other features.
    If you want to view two parts of the same document you will need to rename a copy and place two windows side by side, which is hampered by Pages 5's bloated use of screen real estate.
    Peter

  • Images in HTML forms and/or reports

    Hi,
    Apologies if a stupid question, but can you display a combination of data and image content in Portal HTML forms and/or reports? If so, how?
    This question assumes that the image in question is browser-supported (e.g. gif file), and the link to it is in the same database table as the data being reported (as a bfile data type).
    Alternatively, what if the image was actually directly stored in the database table as a BLOB data type?
    Help!
    Cheers, Jeff

    Hi Sharmila,
    Thanks for the info!
    Would this also work if the image wasn't a blob, but instead just stored on the filesystem (as a gif file), with the reference to it stored in the database as a bfile datatype?
    Thanks once again, Jeff
    Hi,
    You can build portal forms to upload images. You can use blob columns here. You can also have images in a report. This will be the SQL to query data from tables having intermedia data.
    Select a.empno,a.ename,a.mgr,a.sal,
    portal30.wwv_user_utilities.get_intermedia('EMP','EMP_AUDIO','AUDIO',a.rowid)
    the_audio, b.dname,b.loc,
    portal30.wwv_user_utilities.get_intermedia('DEPT','DEPT_PICTURE','IMAGE',b.rowid) the_picture
    from emp a, dept b
    where a.deptno = b.deptno
    The table should have the ordimage column type.
    Thanks,
    Sharmila

  • Send html and  image data to browser

    Hi,
    Is it possible to send both html and image data to browser.
    Can I dynamically generate the image and send the image data without storing the image in web server's hard disk.
    Can you plz tell me what areas that I should look for and learn in order to do this.
    THanks a lot,
    Chamal.

    u can make use of jakarta`s commons fileUploader classes to upload ur file to the server
    here is a small example i made
    html is like this
    <html>
    <form method="post" action="/uploadFile" enctype="multipart/form-data">
    <input type="text" name="uname"/>
    File
    <input type="file" name="upfile"/>
    <input type="submit"/>
    </form>
    </html>
    my servlet contains these code
    FileUpload fup=new FileUpload();
              boolean isMultipart = FileUpload.isMultipartContent(req);
    //          Create a new file upload handler
              System.out.println(isMultipart);
              DiskFileUpload upload = new DiskFileUpload();
    //          Parse the request
              List /* FileItem */ items = upload.parseRequest(req);
              Iterator iter = items.iterator();
              while (iter.hasNext()) {
              FileItem item = (FileItem) iter.next();
              if (item.isFormField()) {
              System.out.println("its a field");
              } else {
              System.out.println("its a file");
              System.out.println(item.getName());
              File cfile=new File(item.getName());
              System.out.println(cfile.getName());
              System.out.println(getServletContext().getRealPath("/mine"));
              File tosave=new File(getServletContext().getRealPath("/"),cfile.getName());
              item.write(tosave);
    for more info
    http://sun.calstatela.edu/~cysun/documentation/jakarta/commons/fileupload-1.0/apidocs/org/apache/commons/fileupload/FileItem.html

  • On YouTube, I can't play playlists there. It says I need to update my Java and it is updated already. When I go to different sites like Yahoo! the links and images are all distorted. This is the second time this has happened to me now

    Hello Firefox,
    I am having problems with my Firefox's image processor I believe. My web browser is fine but then a few minutes later I get some weird look on my page. It then just stays here and I can't fix it. When I go to Yahoo all the links and images do not look normal. I really cannot explain this and wish I could send a picture instead. When I go to the Log in page for Facebook I do not see the image of the small faces networking around the world. It's blank and the links are widely spread apart. With YouTube the page is also distorted. Nothing is arranged properly. I can watch videos. However when I go to someone's profile or a playlist videos cannot play or show up. It says I need to update my Java player and it is already updated. It still happens when I uninstall and re install back. I was only able to fix this problem by uninstalling everything related to Firefox. I do not know how to solve this any other way. I don't like it when all my information is lost such as saved passwords and bookmarks. If there is any way to solve this thanks. I don't want to uninstall this again.

    Your above posted list of installed plugins doesn't show the Flash plugin for Firefox.<br />
    See [[Managing the Flash plugin]] and [[Installing the Flash plugin]]
    You can check the Adobe welcome and test page: http://www.adobe.com/software/flash/about/
    You can use this manual download link:
    *http://kb2.adobe.com/cps/191/tn_19166.html#main_ManualInstaller

  • In Mail 3.6 remote images in HTML messages display as blue squares with ? even though checked in viewing references.

    In Mail 3.6 remote images in HTML messages display as blue squares with ? even though checked in viewing references.

    Nurit,
    The point is that that button should not be there, if the preference setting is as you say. This indicates the preference setting is stuck, and that is what I was trying to help you resolve.
    The full purge is done as follows:
    Quit Mail, and in the Finder open Home/Library and locate the Mail folder. Control-click over the Mail folder, and choose Duplicate -- then drag the resulting copy to the Desktop for temporary backup. Next, open Home/Library/Preferences and find the com.apple.mail.plist file and drag it to the desktop.
    Relaunch Mail, which will open as though new, and when prompted to import anything DECLINE. Instead, re-enter your account info, and Mail will re-discover the account folders for your accounts, and all should be well, after setting preferences as you desire.
    Ask any needed questions, and keep us posted.
    Ernie

  • Display image in html mail

    I was recently sent an email that used an HTML stationery wih several photos embedded in it.  The email opens normally, but all of the images are icons, displaying file name and size.  If I click the icon, the image opens correcly in a separate window. 
    I am running OS X 10.7.3 and Mail 5.2 (1257) and have checked "display remote images in html email" in preferences.  A friend with identical software versions receives the same email and the photos are visible in the original email. Suggestions?

    No-one replied, but I found a solution on another board. Run Terminal (do a Spotlight search if you don't know where to find this), and type: (or copy and past the next line)
    defaults write com.apple.mail DisableInlineAttachmentViewing -bool false
    This will force Mail not to disable inline attachment viewing. Obviously, to reverse this, simple replace 'false' at the end with 'true'.
    Thanks to Louise101 from July 2011 for posting this.

  • How to use CSS and images in a plsql-dbms_output reports?

    Hi.
    Windows 2000 SP4
    SQL Developer 1.2.1.32.13
    Java 1.5.0_07
    Oracle 9.2.0.6
    I'm trying to create a plsql-dbms_output report with HTML that uses a stylesheet (CSS) and an image. These seem to be ignored by the report viewer.
    The following example works fine in Internet Explorer 6 but the stylesheet is ignored by the viewer and the viewer does not show the images (shows broken images instead). I've tried with various image types (PNG, GIF and JPEG).
    <!--
    begin
    dbms_output.put_line('<head><link rel="stylesheet" type="text/css" href="file://c:/temp/core.css"/></head><body>');
    dbms_output.put_line('<H1>This is Level-1 Heading</H1>');
    dbms_output.put_line('<H2>This is a Level-2 Heading</H2>');
    dbms_output.put_line('<p>This is regular paragraph text.</p>');
    dbms_output.put_line('<img src="file://c:/temp/fig01.png"><br>');
    dbms_output.put_line('<img src="file://c:/temp/fig01.gif"><br>');
    dbms_output.put_line('<img src="file://c:/temp/fig01.jpg"><br>');
    dbms_output.put_line('</body>');
    end;
    -->
    Is the HTML viewer limited to not support stylesheets and images?
    Thanks in advance.
    Cheers
    Finn Ellebaek Nielsen

    It also seems that links don't work. The mouse cursor changes to a hand when hovering over links and the links are shown in blue and underlined but nothing happens when clicking on them.
    Example:
    <!--
    <html>
    <head><link rel="stylesheet" type="text/css" href="file://c:/temp/core.css"/></head><body>
    <p>First heading</p>
    <p>Second heading</p>
    <H1 id="x1">This is Level-1 Heading</H1>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    <H2 id="x2">This is a Level-2 Heading</H2>
    <p>This is regular paragraph text.</p>
    <img src="file://c:/temp/fig01.png"><br>
    <img src="file://c:/temp/fig01.gif"><br>
    <img src="file://c:/temp/fig01.jpg"><br>
    <p>First heading</p>
    <p>Second heading</p>
    <p>Other document</p>
    </body>
    </html>
    -->

  • Images and image maps do not respond to events on Safari

    Hello everyone,
    We have been experiencing issues with events not responding to images associated with image maps, on Safari browser. After the DOM is loaded with new image and corresponding image maps, events such as mouseover and click observing this divs do not respond or get triggered. DOM seems to be updated correctly but behaves differently (and it works correctly in all other browsers except Safari).
    This behaviour is only noticed in Safari browser running both on Windows and Mac. (Tested on Safari Version 3.1.1 on running on Windows and Mac)
    For you all to have a closer look at this issue, I have created a sample that has this problem, similar to one we experienced during one of our recent projects. Please click on the link below to get to the sample (I recommend you to try this either in Firefox or IE before you do on Safari)
    http://www.hivegroup.com/safari/test.html
    (In the above sample,
    - the javascript code initializes the DOM with image and image map
    - assigns two event listeners to the div containing this image and image map
    - when mouse pointer brought over the image, it shows the area id in the 'mobox' div
    - when clicked, DOM is updated with a new image and new corresponding image map, assigns new event listeners and should continue with the same kinda behaviour it did for the first image (but doesn't in Safari browser))
    All inputs on this issue are welcome and greatly appreciated.
    Thanking you in advance.
    Regards,
    Shashi.

    Let me explain what the pink area is. Like the first image that contains two white boxes, the pink area (as you call it) is a new image (containing four pink areas or boxes having an area id denoted to each) that imgDiv occupies after the 'click' event occurs.
    Yep, i gathered that from seeing it work on firefox...
    The point that I'm trying to make here is, there shouldn't be any difference in behaviour when imgDiv holds first image (two white boxes) or the second image (four pink boxes) that you get after we click on image or the third image (containing 6 boxes, multiple colors) which you won't be able to reach in safari browser.
    well... I can reach them, but only via the blue space.
    . We'll notice change in the red box displaying target id only when we mouse over a new area that is not currently being displayed in the red box.
    except in webkit for safari 2, where thered bpx content sticks at whatever it was when the first image was clicked, unless mouse is moved to the 'all area', and then it sticks on imgdiv.
    I completely understand what you see in safari 2. But are you saying there's some error in my script ? If so could you please point out and justify.
    I dunno Shashi, just pointing out the errors that Safari 2 reports when I view your test page, in the hope it might help. I know little of javascript

  • Problem in Displaying image in HTML format for BI Publisher (OTM)

    Hello,
    We are using OTM 6.2 and we are developing the IB reports to the customer.
    I am getting dificulty while displaying the image in HTML format. I used image in JPEG format. When i am running the report, It displayed only in PDF format, but not in HTML and Excel format.
    Please do the needful help in this regards.
    Thanks & Regards,
    Siva Donthi

    Hi Kavipriya,
    i have gone thru all your threads on a similar sort of issue which i am facing now, However i m bit struck as i m newbie.
    Issue:i am insering a static picture from the c drive into the header section of the rtf template and when previewing the rtf template on the BI publisher the jpg image disappears. i have tried adding the url into the format picture -->alt tab.Still no signs of improvement.
    However if just placing the jpg image on header section without using the wrap text it gets displayed.But if i use wrap text on the image ,it disappears.
    could you guide me please in fixing this issue .
    Appreciate your timely response and your co-operation
    Thanks
    Joe

  • MIME Multipart/related to embed images in html files - Servlet

    Hello,
    My goal is to embed images in html/xhtml files to decrease latency when using slow networks. Think about mobile phones, if I have 10 images in one page, I will have 11 requests/responses to get the whole page.
    The solution would be to embed all images using Content-type multipart/related, so I have one request to the whole pack.
    How to do that in java? I mean, I need to set the content-type and build all parts encoding the images to base64.
    I tried JavaMail API, there I can build messages like this and instead of send an e-mail, I can write:
    myMimeMultipart.writeTo(response.getOutputStream());
    The problem is: I am getting everything as text in my browser, including the MIME headers of each part. Another think is that the first header (the main one) doesn't appear too.
    Any thoughts/other ideas?
    Thanks in advance,
    Andr� Carlucci

    If memory serves me right, I believe in the Servlet spec you have access to the Response object. You "should" be able to set any headers you need there. In addition, you can get the output streams just as you described.
    I did a similar thing, although slightly modified, to output dynamically-generated XLS (Excel Spreadsheet) files using a reporting engine called JasperReports. It wasn't a multipart response, however, so you may need to figure out how to handle that part of it, but in my case I set the mime-type header, then grabbed the output and started writing my XLS file too it. Once done, you close the streams and return the response. Worked perfect.

Maybe you are looking for

  • OWB Question

    Sorry for that Question but I Have no expierience with OWB. My question are: 1.) Must the OWB Runtime installed on the same Schema as the Datawarehouse (I mean the data not Meta Data) or is it also pissibel to install the OWB Runtime in a different D

  • New phone - iMessage and Facetime not working with number?

    I had a 4s and recently got a 5s, and now iMessage on my Mac only has my email as an option. My phone number is the same. I searched around for a solution, and one involved signing out and back into both iMessage and Facetime on my Mac, so I did, and

  • Listening to changes in tab selection on the JTabbedPane

    How can I to listen to any new selection in another tab of the JTabbedPane? supposed that I want the program to do a certain action each time the user select another tab with the mouse - and an action which is accordingly to the new selected index (o

  • NTLM ticket in WAS

    Hello Everybody, I want to use NTLM authentication in WAS 6.40. My webdynpro application should use NTLM tickets to authenticate user against my LDAP. As per my knowledge, to acomplish this, i require NTLM login module,right? From where i can get suc

  • How do I set the hand tool to be the default tool in Acrobat X?

    I want the hand tool to be the default tool. The select tool is very annoying. This is a recent change - even last week the default tool was whatever tool I had used last. Now the select tool is always selected which is very frustrating. How do I set