Inserting bullets in JeditorPane

Hi All
I have used following code to insert a list item in my JeditorPane
menu.add(new HTMLEditorKit.InsertHTMLTextAction("List", "<ul><li></li></ul>", TML.Tag.UL,HTML.Tag.LI));
But it inserts two list items instead of one.
Can anyone suggest something regarding this.
Thanks
Abhinit

Ok, figured it out myself:
        notesArea.getInputMap().put(KeyStroke.getKeyStroke("enter"), "enterAction");
        notesArea.getActionMap().put("enterAction", new HTMLEditorKit.InsertHTMLTextAction("InsertBR", "<br>", null, HTML.Tag.IMPLIED, null, null));

Similar Messages

  • How To Insert Bullet Points in LIVE in DW CC?

    How do your insert bullet points (ordered or unordered) in LIVEVIEW without using divs or classes? (basic tags)
    I am using DW CC 2014
    Thanks

    THANKS!
    I spend about 10-15 minutes extra time fighting the UI of the LIVE VIEW.
    I am all for the LIVE VIEW as long as it is just as quick to use as Design View when editing WYSIWYG content in Fluid Grid or not.
    It's a good thing I can code 
    Thanks... I look forward to any improvments

  • How do you insert bullets into a keynote presentation?

    I am trying to insert bullets into a custom keynote presentation.  How do you do this?  Then, I need to convert to powerpoint.  Haven't had to do this before.  Is there someone who can walk me through it?

    see the following thread:  https://discussions.apple.com/message/5876208#5876208
    There is also Keynote '09 User Guide available to you in your Help Menu which can be downloaded for free.
    I recommend Chapter 4 for starters.
    Good luck

  • Insert links in jeditorpane

    Hi,
    I am working on an applet that allow a user to edit simple HTML.
    The user can basicly enter plain text, and there are buttons that bold and add links.
    I have also made Enter insert a break tag.
    The code works fine EXCEPT in one case.
    If a user pastes in some text, that has newlines in it, and selects the first word after a newline to become a link, the link appears on the line above where it should be.
    The strange thing is that when I print the jeditorpane text, it looks fine, it just does not display in the pane correctly.
    The code I use is
    editor.replaceSelection("");
    kit.insertHTML( doc, start, "<a href=\"" + link + "\">" + text + "</a>", 0, 0, HTML.Tag.A );
    HOWEVER if I change to
    kit.insertHTML( doc, start, "<a href=\"" + link + "\">" + text + "</a>", 1, 1, HTML.Tag.A );
    I.e. change 0,0 to 1,1 it displays properly BUT only in the case where the word selected is just after a newline.
    I catch Ctrl-V keypresses, to ensure that the user only pastes in the plaintext version of what they are pasting. The problem would be solved if I could replace the newlines with break tags at this stage, but if I do that, the tags appear in the text.
    So (finally) my questions are.
    a) Is there a way to see check for the newline character being before the word selected?
    b) Or is there a way to make the default pasteaction handle break tags as markup rather than plain characters.
    Thanks
    wbxv

    a) Is there a way to see check for the newline character being before the word selected?You can try something like this:
    String newline=System.getProperty("line.separator");
    if (text.startsWith(newline)) text=text.substring(newline.length());
    editor.replaceSelection("");
    kit.insertHTML( doc, start, "<a href=\"" + link + "\">" + text + "</a>", 0, 0, HTML.Tag.A );
    b) Or is there a way to make the default pasteaction handle break tags as markup rather than plain
    characters.You can try something like this:
    int i=text_to_paste.indexOf(newline);   // newline is defined above
    if (i>=0) text_to_paste=text_to_paste.substring(0,i)+"<br>"+text_to_paste.substring(i+newline.length());You can make a loop to replace all newlines with <br> if you like.
    Hope this helps...
    V.V.

  • Inserting HTML into JEditorPane

    I have a window with a JEditorPane on top and a JTextField below it. I need to be able to type raw HTML into the edit field and have it appended to the HTML document displayed above.
    For example if I type...
    This is <b>bold
    I need to append that to the document. However I want the style to stick. Notice I did not close the tag above. I want the next line I enter into the edit field...
    and so is this but not</b> this.
    I want this to appear bold up until the closing tag and then return to normal. The problem is that every time I append new text to the document the style is restored to normal.
    I insert the text with the following code. I send the contents of the JTextField to the following function when I hit return.
    void processInput(String input) {
    try {
    HTMLDocument doc = (HTMLDocument) output.getDocument(); // output is my JEditorPane
    editor.insertHTML(doc, doc.getLength(), input, 0, 0, HTML.Tag.BODY); // editor is HTMLEditorKit
    // relevant catch clauses
    Basically I want the two broken input sequences to appear in the editor as one seamless entry. I want to be able to type these two entries and have them show up as if they were entered as one entry.
    entry 1:This is <b>bold
    entry 2: and so is this but not</b> this.
    I want to somehow cause this to be displayed as if I typed...
    This is <b>bold and so is this but not</b> this.
    Is there a way I can do this?
    Thanks.
    -Russ

    as i understand you you want to write
    entry 1:This is <b>bold
    entry 2: and so is this but not</b> this.
    in two lines
    Try this
    entry 1:This is <b>bold<br>
    entry 2: and so is this but not</b> this.

  • Trouble inserting text into JEditorPane

    Hello.
    I am trying to use a URL Connection and the read method to produce an HTML page in a JEditorPane.
         purlRec is a data record that contains information relating to the URL in question.
         pis is an input stream create from the URLConnection.getInputStream() method
    private void loadFromURL(UrlRecord purlRec, InputStream pis ) {
    URL url;
    String tmpStr = (String)purlRec.getUrlName();
    String baseUrl = (String)purlRec.getUrlName();
    setContentType("text/html");
    try {
    HTMLDocument doc = (HTMLDocument)getDocument();
    doc.setBase(new URL(baseUrl));
    this.read(is,doc);
    repaint();
    catch (Exception e) {
    System.err.println("Couldn't create URL: " + tmpStr);
    System.out.println("error:"+e.getMessage());
    I get the following when I execute the code. Am I not using this correctly or is there something I am missing? I am using the read from input stream so that I can connnect to url that require authentication. I know that the URL connection works because I am able to write the output of the stream to a text file in a test function.
    Couldn't create URL: http://www.google.com
    java.lang.RuntimeException: Must insert new content into body element-
         at javax.swing.text.html.HTMLDocument$HTMLReader.generateEndsSpecsForMidInsert(HTMLDocument.java:1878)
         at javax.swing.text.html.HTMLDocument$HTMLReader.<init>(HTMLDocument.java:1854)
         at javax.swing.text.html.HTMLDocument$HTMLReader.<init>(HTMLDocument.java:1729)
         at javax.swing.text.html.HTMLDocument$HTMLReader.<init>(HTMLDocument.java:1724)
         at javax.swing.text.html.HTMLDocument.getReader(HTMLDocument.java:125)
         at javax.swing.text.html.HTMLEditorKit.read(HTMLEditorKit.java:228)
         at javax.swing.JEditorPane.read(JEditorPane.java:504)
         at javax.swing.JEditorPane.read(JEditorPane.java:478)
         at com.UrlChecker.panels.HTML.EditorPane._$34246(EditorPane.java:105)
         at com.UrlChecker.panels.HTML.EditorPane.changeUrls(EditorPane.java:142)
         at com.UrlChecker.demo.UrlChecker.changeHtml(UrlChecker.java:131)
         at com.UrlChecker.panels.Report.URLTabView.mouseClicked(URLTabView.java:91)
         at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:208)
         at java.awt.Component.processMouseEvent(Component.java:5096)
         at java.awt.Component.processEvent(Component.java:4890)
         at java.awt.Container.processEvent(Container.java:1566)
         at java.awt.Component.dispatchEventImpl(Component.java:3598)
         at java.awt.Container.dispatchEventImpl(Container.java:1623)
         at java.awt.Component.dispatchEvent(Component.java:3439)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3174)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
         at java.awt.Container.dispatchEventImpl(Container.java:1609)
         at java.awt.Window.dispatchEventImpl(Window.java:1585)
         at java.awt.Component.dispatchEvent(Component.java:3439)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
    error:Must insert new content into body element-
    Thank you

    I tried using this, but I get an UNAUTHORIZED Status code (401) indicating request requires HTTP authentication. ( HttpServletResponse error code ). This is why the encoded authentication is used. It works when I try to just read from the url using an InputStream but not when I try passing the same InputStream to the JEditorPane.
    Any Idea of how to use JEditorPane.read(InputStream in , Object desc) or why it would work in one instance and not in the other?
    Thanks

  • Insert sentences into JEditorPane

    Hi,
    I am trying to insert a user input sentence into JEditorPane. Before that, the user will type a word which is search for in the JEditorPane. when the word is found in a sentence, the user's input sentence is inserted to be the line juz after the line with the keyword.
    from http://forum.java.sun.com/thread.jspathreadID=650821&messageID=3827757
    i learnt how to find the line which contains the keyword, but how do i push the subsequent lines downwards, and insert the user's sentence in between them??
    Regards,
    yiming

    I am on a roll this morning.
    I am still pulling my hair out with the kit but here is what I did.
    First get the editor kit. If you traverse the code there are a lot of actions that are built it.
    I grabbed these actions in the following manner.
    HTMLEditorKit kit = new HTMLEditorKit();
    Map _editActionMap;
    Action[] action = kit.getActions();
    for ( int iIndex = 0; iIndex < action.length; iIndex ++ ) {
    // if you want to see the action name.
    System.out.println( action.toString());
    // Build a convient hash of the actions by name.
    _editActionMap.put( action[iIndex].getValue( Action.NAME ), action[iIndex] );
    Now you have a map of all the built in actions. Guess what insert table is in the list. Do see the rest just iterator through the list and print them out.
    Now you have the actions.
    Add the action for insert table to a pop up menu.
    tableMenu is a JPopmenu menu.
    JMenuItem menu;
    menu = tableMenu.add( (Action)_editActionMap.get( "InsertTable" ));
    menu.setText( "Insert Table" );
    The default label is the actions name. So I simply rename the pop menu title.
    Cut, copy, paste, bold, italic are also in there.
    Regards
    Carl

  • URGENT - Bullets in JEditorPane

    im workin on a HTML editor.
    im trying to have a toggle button which will insert a bullet and also remove the bullet for a sentence. im able to insert the bullet.
    BUT IM NOT ABLE TO REMOVE BULLETS.
    Any help on this would be greatly appreciated.
    thank you

    Hi,
    you could read the HTML portion containing the bullet(s) into a string, then parse the string for UL and LI tags and remove them, then you could write the HTML string back to the document replacing the portion previously read.
    To extract the existing HTML, you would place the caret somewhere into the bullet list and call getParagraphElement for that position. With the Element you call getParentElement until you have the UL tag. With the Element containing the UL tag, you can call getStartOffset and getEndOffset to extract the HTML. To copy the HTML to a string you can use a StringWriter as follows
        HTMLDocument doc = (HTMLDocument) editorPane.getDocument();
        EditorKit kit = (EditorKit) editorPane.getEditorKit();
        StringWriter sw = new StringWriter();
        kit.write(sw, doc, start, length);The HTML then is in sw.getBuffer().toString()
    Once you manipulated the HTML as appropriate, you can write back as shown above with EditorKit.read()
    Hope that helps
    Ulrich

  • Inserting Bulleted List in iPad Email?

    Does anyone know if you can insert a Bulleted or numbered list into an email on the iPad 3 with the new iOS?

    Better ask in the iWork for iOS forum.
    Here, most of us don't use these products.
    Maybe my memory is fool but something tell me that I read somewhere that the feature is unavailable on iDevices.
    Here is a link which may be helpful:
    http://www.howtogeek.com/howto/14529/the-complete-list-of-ipad-tips-tricks-and-t utorials/
    Yvan KOENIG (VALLAURIS, France) vendredi 10 juin 2011 16:50:30
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.7
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • Inserting bullet points within Interactive adobe forms

    Hi,
         I would like to know if it would be possible to include "Bullets & Numbering" within Interactive adobe forms similar to MS word. Please kindly let me know.
    thanks
    anantharam

    Hi Anantharam,
    If you want to place bullets that will remain static, say U need to put certain notes on the form using the bullets preceding them,
    Yes this can be done, but a little tricky, just write the stuff in a word document with bullets, just copy and paste it into your Interactive form..this is the thing i had also implemented in my case, solved my problem..
    but in case u need to add this somewhere which is a runtime specific thing, i haven't yet tried such thing.
    Hope this helps.
    Regards
    Amita

  • Inserting HTML in JEditorPane

    Extremely frustrating trying to work with the HTML editing model (JEditorPane - content type text/html). I am using 1.4.2_06. Tying some basic actions to buttons or keystrokes is no problem (eg bold, italic etc.) but the most NB things like being able to drop a <br> in where the user presses enter doesn't seem possible. Has anyone found a way to drop in HTML at the caret? Would hugely appreciate any ideas.
    Matthew

    Ok, figured it out myself:
            notesArea.getInputMap().put(KeyStroke.getKeyStroke("enter"), "enterAction");
            notesArea.getActionMap().put("enterAction", new HTMLEditorKit.InsertHTMLTextAction("InsertBR", "<br>", null, HTML.Tag.IMPLIED, null, null));

  • Insert bullets in a long text column seperated by Enter Sign!

    I have a long text column
    For example my text looks like
    <TEXT>
    A
    B
    C
    D
    </TEXT?
    I want the output as
    ·A
    ·B
    ·C
    ·D
    I tried <?position> its giving me numbers. I want the bullets and not the numbers.
    Any idea?
    Thanks,
    -Ritu

    REPLACE(the_field, chr(10), chr(10)||chr(149)||'   ')

  • How do I insert checkboxes into a Pages document?

    I have been trying to insert checkboxes into a document I created using Pages version 2.4.2 on my iPad Air. I would like an actual checkbox (not just the image of an empty box) so that a checkmark will appear once it has been selected. I am able to do this with the "Numbers" app, but I cannot copy and paste those check boxes to a Pages document.
    I want to use this document as a form I can easily access and print with checkboxes. I have only found a way to insert bullets, but not checkboxes that you can click on with your finger and a check mark appears in the checkbox.
    Thank you!

    I think you are misunderstanding "Insert text at cursor". The ANNOTATIONS are not text editing tools, rather they are tools for people making comments to "mark up" documents. You use "Insert text at cursor" to tell the document author you want HIM OR HER to insert text at that point; the author reviews all the comments and changes the original.
    You need to use one of the OTHER methods mentioned to actually add text. Probably simplest is the typewriter tool, which in Acrobat X is under TOOLS > CONTENT and is called ADD OR EDIT TEXT BOX.

  • How could I edit correctly my bullets in my html editor

    I try to manage bullets in a simple HTML Editor.
    To do that, I used two differents methods but they both failed.
    When I look at the generated source code, my tags correcty exist but in the HTMLDocument, I can't see the text well formatted.
    Is anybody could help me?
    Thanks a lot
    Here is the two methods I chose:
    The first one was:
    MutableAttributeSet attr = new SimpleAttributeSet();
    attr.addAttribute(StyleConstants.NameAttribute, style);
    int xStart = m_HTMLEditor.getSelectionStart();
    int xFinish = m_HTMLEditor.getSelectionEnd();
    m_doc.setParagraphAttributes(xStart, xFinish - xStart, attr, false);
    And the second one was:
    try{
         MutableAttributeSet attr = new SimpleAttributeSet();
         attr.addAttribute(StyleConstants.NameAttribute, HTML.Tag.LI);
         m_doc.insertString(m_HTMLEditor.getSelectionStart(), m_HTMLEditor.getSelectedText(), attr);
    catch(Exception ex) {                         IdeMessageManagerAccess.printMessage(IdeMessageType.INFORMATION, "An exception occured during the inserting bullet");
    }

    Hi,
    implementing list formatting for HTMLDocuments is complex. To format an arbirtrary text portion as list, <ul> or <ol> and <li> tags have to be added to respective text.
    As one can not predict if a selected text portion has already list formatting or contains a mixture of list and plain text formatting, there are a lot of cases to implement.
    My proposal is to just copy a working implementation as it is present in application SimplyHTML at http://www.lightdev.com/template.php4?id=3
    Ulrich

  • Keyboard Shortcut for bullets (Command-Shift-L) no longer works

    Hey Guys,
    It seems so odd and I find it so irritating that I have been using this keyboard shortcut which is Command-Shift-L for bullets in Outlook, Notes and almost any word processing applications. All of a sudden this seems to have gone and now replaced by a Google Search. I tried researching a lot on the internet and found many articles which confirmed that this was indeed a keyboard shortcut but I couldnt find even one which could tell me what happened to it and how to make it work again. I've got so used to this shortcut because my work involves mainly around drafting emails and documents.
    I have Macbook Pro Retina 13inch 2013 model & running Mac OSX 10.9.4 OS.
    Now I did find one website link which told me how to disable the Safari trigger for this shortcut and I was successful in removing that shortcut. But I am stuck at the point where it's just blank. So now when I press these keys, nothing happens because no shortcut is set to it. I am moving in circles and would really appreciate if anyone can help.
    P.S I've already gone through many links which say create paragraphs, this and blah blah but sorry I am not interested in that....Some links also say that Option + 8 key works for the bullets but that doesnt work for me either. However, I dont want that too. I would want the original shortcut which was there and would really appreciate if someone can tell me how to get it back or even configure it back to the way it was. Sorry for being rude but I am just frustrated with the long hours I have spent in fixing this silly issue and don't want the similar answers which I have already come across on the other links. Your help is much appreciated. Thank you in advance!

    Thanks for your reply. I can't seem to find the bullets option in Shortcuts. Could you give me more details on how to make that happen.
    There is no bullets option in Shortcuts.  Defining shortcuts works by binding menu items in an application to a key combination. You have to find the name of a menu item in the application   you are using.
    For example in "Notes" is a menu "Format > Lists > Insert Bulleted List"
    To bind it to the shortcut "⇧⌘L" open the Keyboard System Preferences > Shorttcuts tab and press "+" to add an application shortcut.
    Type the name of the menu item "Insert Bulleted List" and enter the key combination.
    This will work in "Notes", but you have to identify the names of menu items that will produce bullets  in your other applications, if you want to add the shortcut for them.

Maybe you are looking for