How to insert HTML content directly in code from JEditorPane ?

I'm developping an HTML Editor on a JEditor Pane.
The problem is that a blank is not interpreted, and i've tried to add "& n b s p ;" in the code from a KeyListener added to the VK_SPACE event, or to define an Action to add HTML Spaces. But i didn't achieve to...
I just want to insert a "& n b s p ;" in the HTML code of the document displayed in the JEditor evry time the SpaceBar is pressed.
I've tried InsertContentAction() :
Not a solution :It inserts " & n b s p ;" in the text (it appears litteraly).
I've tried InsertHTML. But it needs a tag parameter, and in my case, i need no tag
to be inserted.
I'm stuck since days... Any help woul be extremely appreciated...

The code I now have is:
TextAction actInsertNBSP = new TextAction("insert-space"){    
public void actionPerformed(ActionEvent evt){
//Where is the cursor now
int intInitialCaretPos = text.getCaretPosition();
try{       
     //Make HTML document to add the html code
     HTMLDocument htmldoc = (HTMLDocument)text.getStyledDocument();
     //Get document input attributes before insert
     AttributeSet atr = kit.getInputAttributes().copyAttributes();
     //Insert tag
     kit.insertHTML(htmldoc,intInitialCaretPos,"<b>\240</b>", 0, 0, HTML.Tag.B);
     //Set stored attributes to input attributes
     kit.getInputAttributes().addAttributes(atr);
     //Set cursor on right position
     text.setCaretPosition(text.getCaretPosition());                    
     }catch (Exception exc){
          exc.printStackTrace();
KeyStroke kstSpace = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0);
text.getKeymap().addActionForKeyStroke(kstSpace,actInsertNBSP);

Similar Messages

  • How to insert HTML content in a IVIEW

    Hi,
    How to insert HTML content in a iview any body help me with the solution.
    Thanks & Regards
       kiran.B

    Hi,
    You can just spit out HTML in the request object:
    request.write("<B>Whatever</B>");
    Or if you have a single HTML page, you might want to just add it to KM and create an iView from it.
    Hope this helps.
    Daniel

  • How I post HTML and Video embed code from my component to landing page?

    Hi there,
    How I post HTML and Video embed code from my component to landing page?
    My Components are developed in NODEJS and PHP.
    Thanks

    Answered here http://topliners.eloqua.com/thread/7944

  • How to insert html table inside java code

    Hi,
    I want to send an email with data in table format(with rows and columns) .Please tell me how to achieve this in java code .I just want to know the code for making the table in java
    Please help me
    Thanks in advance

    NewUser7 wrote:
    Please tell me how to generate html tables in java. .. Do you know how to produce an HTML table in HTML?
    ..i dont have jspI did not mention JSP. Pure J2SE code can produce HTML, though if done in a web-app., it would generally be done using JSP or Servlets.
    Here is an example of producing HTML in J2SE.
    import javax.swing.*;
    class HtmlTable {
         public static void main(String[] args) {
              int[][] values = {
                   {1,3894,5387},
                   {2,4112,4459},
                   {3,4886,6076}
              String prefix = "<html><body><table>\n";
              final StringBuilder sb = new StringBuilder(prefix);
              sb.append("<tr>");
              sb.append("<th>");
              sb.append("Month");
              sb.append("</th>");
              sb.append("<th>");
              sb.append("Unit A<br>Sales");
              sb.append("</th>");
              sb.append("<th>");
              sb.append("Unit B<br>Sales");
              sb.append("</th>");
              sb.append("</tr>\n");
              for (int ii=0; ii<values.length; ii++) {
                   sb.append("<tr>");
                   for (int jj=0; jj<values[ii].length; jj++) {
                        sb.append("<td>");
                        sb.append("" + values[ii][jj]);
                        sb.append("</td>");
                   sb.append("</tr>\n");
              sb.append("</table>");
              sb.append("</body>");
              sb.append("</html>");
              Runnable r = new Runnable() {
                   public void run() {
                        JOptionPane.showMessageDialog(
                             null,
                             new JTextArea(sb.toString(),20,10) );
                        JOptionPane.showMessageDialog(
                             null,
                             new JLabel(sb.toString()) );
              SwingUtilities.invokeLater(r);
    As an aside, those terms are HTML (an abbreviation) Java (a proper name) & JSP (an abbreviation). Please try to use correct upper/lower case when using technical terms.

  • How to feed html content in Mail App from Indesign

    Anyone knows how Martha Stewart Everday Food Magzine achieved launching the ipad Mail App filled in with HTML body content directly from their digital magazine?
    At the end of each recipe, there is an email icon displayed, and when you click on it ipad mail launches with html content filled in and ready to share with a friend.
    Please help
    Stanly

    Please refer to this, "Scenario eMail/a: Share your article text as eMail"
    http://digitalpublishing.tumblr.com/tagged/Working_in_InDesign
    Hope it helps.
    shimoawazu

  • How to attach HTML content to DMS Document?

    Hello,
    I have a requirement in which I have to make a HTML file which contains the current Dispaly on screen, I have to attach this HTML file inside the DMS document.
    For this I am doing following steps.
    1 ) FM SAVE_LIST
    2) FM WWW_HTML_FROM_LISTOBJECT, form this FM I am getting the Internal table which is containing the HTML content.
             a) I am converting this internal table content ot first in XSTRING using FM SCMS_TEXT_TO_XSTRING
             b) And XSTRING to Binary format.
    3) After this I am creating a DMS cocument using FM CVAPI_DOC_CREATE
    3) After DMS document creation I am using FM CVAPI_DOC_CHECKIN to attach HTML file content to this DMS Document.
    Everthing seems to be ok, but when I am using CV03N to view the document, its showing the HTML file bu not showing the original content(HTML)
    Please help to find the problem, Is there any other way from which I could CHECKIN HTML content directly inside DMS document in HTML form without converting it to binary.

    HI,
    I have not understood the requirement.
    As far as I know, HTML need not to be checked in.
    Refer also link below
    Re: some questions on SAP DMS
    May be useful in choice of FM.
    Regards
    Nitin

  • How to print HTML contents

    can anyone tell me how to print HTML contents...i needed it urgently
    Thanks

    actually i have a print button on html page....when i click on print button using window.print(); the html page gets printed...but along with it print button is also printed...i dont want print button to be printed...
    this is the issue...
    please resolve it
    Thanks a lot...

  • How to insert business content in BI7

    Hi expert:
               How to insert business content in BI7?I have some example(BW3.0) to follow .  It tells me to active '0plant' in TC 'RSA5' and 'RSA6', but I cant find it.
    Allen

    hi Bhanu:
          thanks! And I have another questions to ask.
          1.Why it tell me 'Application component LO-IO of DataSource 0PLANT_ATTR does not exist'?
          2.how to 'atransfer the hierarchy with Business Content'?
          3.What does 'content delta' use?
         Could u explain it to me particularly?
    Allen
    BR

  • CS 5.5 How to insert header into pre-fab design --- from a sophomoric neophyte

    CS 5.5 How to insert header into pre-fab design --- from a sophomoric neophyte
    Essentially, I have one basic HTML class from several years ago, and a beginning DW class in 2008.
    i am trying to figure out if I can insert a header or otherwise edit the top of this pre-fab DW site.
    http://www.doyle.thibert.com/neos/index.html
    Thanks in advance for your sage advice.
    Doyle

    Learn all you can about HTML and CSS first.  DW expects you to know coding fundamentals. 
    HTML, CSS & Web Design Theory Tutorials -
    http://w3schools.com/
    http://www.csstutorial.net/
    http://phrogz.net/css/HowToDevelopWithCSS.html
    http://webdesign.tutsplus.com/sessions/web-design-theory/
    Then work through David Powers' 5-part tutorial
    Creating  your first web site in DW -
    http://www.adobe.com/devnet/dreamweaver/articles/first_website_pt1.html
    Good luck!
    ❄  ☃  ❄Nancy O.

  • How can I download content of wiki pages from Office 365 online Sharepoint site using c#?

    How can I download content of wiki pages from Office 365 online Sharepoint site using c#?
    Ratnesh[MSFT]

    Hi,
    According to your post, my understanding is that you want to download content of wiki pages on SharePoint Online.
    If just for getting the text of the page, I suggest you convert page to PDF file first and then download the PDF file via a Visual Web Part as a Sandboxed solution.
    A sample about export HTML to PDF:
    http://hamang.net/2008/08/14/html-to-pdf-in-net/
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Patrick Liang
    TechNet Community Support

  • How i can generat VHDL or Verilog code from labview code

    how i can generat VHDL or Verilog code from labview code ( i have a labview code and i want to convert it to VHDL or Verilog code how i can do that )

    Mouath,
    There is no feature in LabVIEW to export your VIs as VHDL files. You are able to include your own HDL in your LabVIEW VI (using the HDL node). I encourage you to provide your feedback related to this issue at ni.com/contact. The product suggestion submitted are taken seriously and reviewed by National Instruments.
    Cheers,
    Jonah
    Applications Engineer
    National Instruments
    Jonah Paul
    Marketing Manager, Embedded Software
    Evaluate the LabVIEW RIO Platform! - ni.com/rioeval

  • How to insert into a table in database1 from a table in database2?

    hi!
    how to insert into a table in database1 from a table in
    database2?
    can anyone help?
    Tariq.

    using the EXEC_SQL package.
    see form help for detail.
    Regards.

  • How do java software developers protect their code from their customers...

    How do java software developers protect their code from their customers, if their code can be easliy decompiled? I will really like to know how to protect my .jar archives and .class files.
    Thanks,
    RilwanJ

    That depends on what you mean by 'protect', and how paranoid you are.
    The best way is with the license, but then... it's nearly impossible to know when someone violates the license.
    You could make the source available to them for a reasonable fee (many companies won't even consider your product unless they can get the source).
    And of course if you are really paranoid, you could obfuscate it. There are a bunch of tools around to do that. But obfuscating has it's own significant set of drawbacks.
    Ultimately if you want your customers to take you seriously, you have to trust them. Onerous protection will usually cause them to look elsewhere.

  • Inserting HTML content into an animated DIV

    Can you, and if so how, insert HTLM content into an EGDE animated Div box? Specificaly an HTML table?  I can get the html code in the box but it won't read/render it as html code. In flash you can tell the program that the contents of the box is html code and it will read it as such but I don't see any way to do that here. I've tried several ways and I can get the code to display in the box but it won't render the code instruction in the boxCan it be done ??
    Thanks
    joel

    Hi,
    1) Your json file is not valid.
    You can copy and paste your datas here: http://jsonlint.com/
    Red commas must be deleted.
          "player": [
                "image": "images/player1.jpg",  //this is the URL I want to retrive
               "name": "player1",
                "image": "images/player2.jpg",
                "name": "player2", 
                "image": "images/player3.jpg",
                "name": "player3", 
                "image": "images/player4.jpg",
                "name": "player4",
    2)An example from http://docs.jquery.com/Ajax/jQuery.getJSON:
    3) compositionReady Tests.
    On compositionReady, i write:
    var profiles = {
                   "player": [
                        "image": "images/player1.jpg",
                        "name": "player1",
                         "image": "images/player2.jpg",
                         "name": "player2", 
                         "image": "images/player3.jpg",
                         "name": "player3", 
                         "image": "images/player4.jpg",
                         "name": "player4",
    console.log(profiles.player[1].image); // this line returns: "images/player2.jpg"
    Note: i deleted the first "[" and the last "]".

  • How to display html content with image in Adobe Flash and Flex mobile project?

    Hi,
      I have a html content with image in it. How to display it in Adobe Flash Builder and Flex mobile project? Which control needs to be used for this?

    Hello,
    The only current way is to use an iFrame, or if you only need some html tags you could use the Text Layout Framework.
    Here this is the iFrame approach:
    http://code.google.com/p/flex-iframe/
    If the swc do not work in Flex4 just use its ource code which works...
    ...it is basically based on this:
    http://www.deitte.com/archives/2008/07/dont_use_iframe.htm
    see also and vote, please:
    http://bugs.adobe.com/jira/browse/SDK-12291
    http://bugs.adobe.com/jira/browse/SDK-13740
    Regards
    Marc

Maybe you are looking for

  • Canon iR-ADV driver and Mavericks update

    I am trying to add a Canon iR-ADV C55035 to a mac running mavericks 10.9.3. (I think) The printer/copier is on a network at work in a Windows environment. I found the software at Canon and downloaded it. It was the PS version and it said it was good

  • IPod Classic Error when connecting - I cant put new music!!

    When i plug in my newish (6 month old) IPOD classic to the Mac it immediately tells me - "Mac OS X cant repair the Disc "... ipod". You can still open or copy files on the disc but you cant change or save files on the disc. Back up the disc and refor

  • Going from Photoshop Elements 6 to 11

    Hi everyone-- I am a Windows user who has working with Photoshop Elements 6.  After bypassing on several newer versions, I went ahead and purchased the full version of Photoshop Elements 11. I was hoping to get some confirmation on what I believe are

  • Jpeg images and color gamuts

    When I make a jpeg image in my camera, it is assigned the adobe rgb gamut. What happens when it is imported in LR? Does the gamut change to prophoto automatically? When I print the jpeg do I have to specify the color gamut? If it isn't prophoto rgb,

  • Data integrator current version to be downloaded

    Hello experts, I want to install Data integrator on my system. Can you please let me know which version of data integrator need to be downloaded. My OS is windows. I am downloading it from service marketplace. waiting for your reply. Appreciate your